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/[email protected] Cc: [email protected] Fixes: d380dcd ("tracing: Fix now invalid var_ref_vals assumption in trace action") Signed-off-by: Xiaoke Wang <[email protected]> Signed-off-by: Steven Rostedt (Google) <[email protected]>
1 parent 4ed308c commit e629e7b

File tree

1 file changed

+1
-0
lines changed

1 file changed

+1
-0
lines changed

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)