]> git.ipfire.org Git - thirdparty/kernel/linux.git/commitdiff
tracing/synthetic: Free type string on error path
authorYu Peng <pengyu@kylinos.cn>
Wed, 3 Jun 2026 06:25:33 +0000 (14:25 +0800)
committerSteven Rostedt <rostedt@goodmis.org>
Tue, 7 Jul 2026 17:59:55 +0000 (13:59 -0400)
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>
kernel/trace/trace_events_synth.c

index cdd5b93328358442691cf3f3c511980e28267bd5..dc15658a887cb74d7ef4504dc869d652ef9d1c17 100644 (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);