diff options
| author | Weigang He <geoffreyhe2@gmail.com> | 2026-01-19 11:45:42 +0000 |
|---|---|---|
| committer | Steven Rostedt (Google) <rostedt@goodmis.org> | 2026-01-23 13:34:45 -0500 |
| commit | 361eb853c655288f3b5c8020f6cd95d69ffe6479 (patch) | |
| tree | 293dc8d30a0207e508ce165c6366d40f6cf3e0af /include/asm-ppc/git@git.tavy.me:linux.git | |
| parent | c9703d17d2c86eda38fe4917ca70c27ec9dbe162 (diff) | |
scripts/tracepoint-update: Fix memory leak in add_string() on failure
When realloc() fails in add_string(), the function returns -1 but leaves
*vals pointing to the previously allocated memory. This can cause memory
leaks in callers like make_trace_array() that return on error without
freeing the partially built array.
Fix this by freeing *vals and setting it to NULL when realloc() fails.
This makes the error handling self-contained in add_string() so callers
don't need to handle cleanup on failure.
This bug is found by my static analysis tool and my code review.
Cc: Masami Hiramatsu <mhiramat@kernel.org>
Cc: Mathieu Desnoyers <mathieu.desnoyers@efficios.com>
Fixes: e30f8e61e2518 ("tracing: Add a tracepoint verification check at build time")
Link: https://patch.msgid.link/20260119114542.1714405-1-geoffreyhe2@gmail.com
Signed-off-by: Weigang He <geoffreyhe2@gmail.com>
Signed-off-by: Steven Rostedt (Google) <rostedt@goodmis.org>
Diffstat (limited to 'include/asm-ppc/git@git.tavy.me:linux.git')
0 files changed, 0 insertions, 0 deletions
