Re: [PATCH v2] scripts/tracepoint-update: fix memory leak in add_string() on failure
From: Steven Rostedt <rostedt@goodmis.org>
Date: 2026-01-23 17:42:00
Also in:
lkml
From: Steven Rostedt <rostedt@goodmis.org>
Date: 2026-01-23 17:42:00
Also in:
lkml
On Wed, 21 Jan 2026 11:22:53 +0900 Masami Hiramatsu (Google) [off-list ref] wrote:
quoted
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 looks not enough. If the memory allocation is failed, it should NOT continue anything. I think we need to make the command itself failure when it fails to allocate memory, as below:
That's a separate bug. I'm taking this current patch as-is as a fix for the leak. Not stopping immediately is a separate issue. -- Steve