]> git.baikalelectronics.ru Git - kernel.git/commit
tracing/histogram: Fix a potential memory leak for kstrdup()
authorXiaoke Wang <xkernel.wang@foxmail.com>
Tue, 25 Jan 2022 04:07:15 +0000 (12:07 +0800)
committerSteven Rostedt (Google) <rostedt@goodmis.org>
Fri, 28 Jan 2022 00:15:44 +0000 (19:15 -0500)
commitadbaa0c75ccef634fe1e7dc74d738a7905d87739
tree9b3e6b47fb8de12ad01e28e23708d55c02a65b80
parent8f99fb1b01a2131f62712a56435305377c7eaaec
tracing/histogram: Fix a potential memory leak for kstrdup()

kfree() is missing on an error path to free the memory allocated by
kstrdup():

  p = param = kstrdup(data->params[i], GFP_KERNEL);

So it is better to free it via kfree(p).

Link: https://lkml.kernel.org/r/tencent_C52895FD37802832A3E5B272D05008866F0A@qq.com
Cc: stable@vger.kernel.org
Fixes: a264f7b516dc7 ("tracing: Fix now invalid var_ref_vals assumption in trace action")
Signed-off-by: Xiaoke Wang <xkernel.wang@foxmail.com>
Signed-off-by: Steven Rostedt (Google) <rostedt@goodmis.org>
kernel/trace/trace_events_hist.c