Skip to content

Commit e629e7b

Browse files
x2018rostedt
authored andcommitted
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: d380dcd ("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>
1 parent 4ed308c commit e629e7b

1 file changed

Lines changed: 1 addition & 0 deletions

File tree

‎kernel/trace/trace_events_hist.c‎

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -3935,6 +3935,7 @@ static int trace_action_create(struct hist_trigger_data *hist_data,
39353935

39363936
var_ref_idx = find_var_ref_idx(hist_data, var_ref);
39373937
if (WARN_ON(var_ref_idx < 0)) {
3938+
kfree(p);
39383939
ret = var_ref_idx;
39393940
goto err;
39403941
}

0 commit comments

Comments
 (0)