[lkml]   [2020]   [Sep]   [29]   [last100]   RSS Feed
Views: [wrap][no wrap]   [headers]  [forward] 
Messages in this thread
Patch in this message
Subject[PATCH 5.4 374/388] tracing: fix double free
From: Tom Rix <>

commit 46bbe5c671e06f070428b9be142cc4ee5cedebac upstream.

clang static analyzer reports this problem

trace_events_hist.c:3824:3: warning: Attempt to free
released memory

In parse_var_defs() if there is a problem allocating
var_defs.expr, the earlier is freed.
This free is duplicated by free_var_defs() which frees
the rest of the list.

Because free_var_defs() has to run anyway, remove the
second free fom parse_var_defs().


Fixes: 30350d65ac56 ("tracing: Add variable support to hist triggers")
Reviewed-by: Tom Zanussi <>
Signed-off-by: Tom Rix <>
Signed-off-by: Steven Rostedt (VMware) <>
Signed-off-by: Greg Kroah-Hartman <>

kernel/trace/trace_events_hist.c | 1 -
1 file changed, 1 deletion(-)

--- a/kernel/trace/trace_events_hist.c
+++ b/kernel/trace/trace_events_hist.c
@@ -4770,7 +4770,6 @@ static int parse_var_defs(struct hist_tr

s = kstrdup(field_str, GFP_KERNEL);
if (!s) {
- kfree(hist_data->attrs->[n_vars]);
ret = -ENOMEM;
goto free;

 \ /
  Last update: 2020-09-29 13:46    [W:1.020 / U:4.260 seconds]
©2003-2020 Jasper Spaans|hosted at Digital Ocean and TransIP|Read the blog|Advertise on this site