tracing/uprobes: Fix memory leak of tail in __trace_uprobe_create()
When generating a default event name in __trace_uprobe_create(), tail is
allocated with kstrdup() without __free(kfree). If the subsequent
kmalloc() for buf fails, the function returns -ENOMEM immediately and
leaks tail.
Declare tail with __free(kfree) so it is automatically freed on all
exit paths.
Link: https://lore.kernel.org/all/179455856197.403392.16569431894958507645.stgit@devnote2/
Reported-by: Sashiko <sashiko-bot@kernel.org>
Closes: https://lore.kernel.org/all/sashiko-outbox-204240@kernel.org/
Fixes: 97e8230f89a3 ("tracing: uprobe-event: Allocate string buffers from heap")
Cc: stable@vger.kernel.org
Signed-off-by: Masami Hiramatsu (Google) <mhiramat@kernel.org>
1 file changed