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)
committerGreg Kroah-Hartman <gregkh@linuxfoundation.org>
Tue, 1 Feb 2022 16:25:39 +0000 (17:25 +0100)
commitd71b06aa995007eafd247626d0669b9364c42ad7
treef6f17926da7fe0cb95b54403ccca01c7c93f559d
parent561a22d44acc3914d65c9a995540945b0c6b766d
tracing/histogram: Fix a potential memory leak for kstrdup()

commit e629e7b525a179e29d53463d992bdee759c950fb upstream.

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>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
kernel/trace/trace_events_hist.c