tracing/synthetic: Free type string on error path

parse_synth_field() builds a "__data_loc ..." type string before
assigning it to field->type. If the seq_buf check fails, the common
cleanup cannot free the temporary string. Free it before leaving.

Link: https://patch.msgid.link/20260603062533.1096320-2-pengyu@kylinos.cn
Signed-off-by: Yu Peng <pengyu@kylinos.cn>
Signed-off-by: Steven Rostedt <rostedt@goodmis.org>
This commit is contained in:
Yu Peng
2026-06-03 14:25:33 +08:00
committed by Steven Rostedt
parent 50fd6dd755
commit 05074bb90a

View File

@@ -839,8 +839,10 @@ static struct synth_field *parse_synth_field(int argc, char **argv,
seq_buf_puts(&s, "__data_loc ");
seq_buf_puts(&s, field->type);
if (WARN_ON_ONCE(!seq_buf_buffer_left(&s)))
if (WARN_ON_ONCE(!seq_buf_buffer_left(&s))) {
kfree(type);
goto free;
}
s.buffer[s.len] = '\0';
kfree(field->type);