]> 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)
commite629e7b525a179e29d53463d992bdee759c950fb
tree9b3e6b47fb8de12ad01e28e23708d55c02a65b80
parent4ed308c445a1e3abac8f6c17928c1cb533867e38
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: d380dcde9a07c ("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