Skip to content

Commit 30d20fb

Browse files
namhyungacmel
authored andcommitted
perf trace: Fix leaks of 'struct thread' in set_filter_loop_pids()
I've found some leaks from 'perf trace -a'. It seems there are more leaks but this is what I can find for now. Fixes: 082ab9a ("perf trace: Filter out 'sshd' in the tracer ancestry in syswide tracing") Reviewed-by: Howard Chu <howardchu95@gmail.com> Signed-off-by: Namhyung Kim <namhyung@kernel.org> Cc: Adrian Hunter <adrian.hunter@intel.com> Cc: Ian Rogers <irogers@google.com> Cc: Ingo Molnar <mingo@kernel.org> Cc: Jiri Olsa <jolsa@kernel.org> Cc: Kan Liang <kan.liang@linux.intel.com> Cc: Peter Zijlstra <peterz@infradead.org> Link: https://lore.kernel.org/r/20250403054213.7021-1-namhyung@kernel.org [ split from a larget patch ] Signed-off-by: Arnaldo Carvalho de Melo <acme@redhat.com>
1 parent bb3de7f commit 30d20fb

File tree

1 file changed

+3
-0
lines changed

1 file changed

+3
-0
lines changed

tools/perf/builtin-trace.c

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -4128,10 +4128,13 @@ static int trace__set_filter_loop_pids(struct trace *trace)
41284128
if (!strcmp(thread__comm_str(parent), "sshd") ||
41294129
strstarts(thread__comm_str(parent), "gnome-terminal")) {
41304130
pids[nr++] = thread__tid(parent);
4131+
thread__put(parent);
41314132
break;
41324133
}
4134+
thread__put(thread);
41334135
thread = parent;
41344136
}
4137+
thread__put(thread);
41354138

41364139
err = evlist__append_tp_filter_pids(trace->evlist, nr, pids);
41374140
if (!err && trace->filter_pids.map)

0 commit comments

Comments
 (0)