[PATCH v1 11/20] perf stat: Avoid evlist leak
From: Ian Rogers
Date: Tue Jun 06 2023 - 21:46:03 EST
Free evlist before overwriting in "perf stat report" mode. Detected
using leak sanitizer.
Signed-off-by: Ian Rogers <irogers@xxxxxxxxxx>
---
tools/perf/builtin-stat.c | 1 +
1 file changed, 1 insertion(+)
diff --git a/tools/perf/builtin-stat.c b/tools/perf/builtin-stat.c
index c87c6897edc9..fc615bdeed4f 100644
--- a/tools/perf/builtin-stat.c
+++ b/tools/perf/builtin-stat.c
@@ -2427,6 +2427,7 @@ static int __cmd_report(int argc, const char **argv)
perf_stat.session = session;
stat_config.output = stderr;
+ evlist__delete(evsel_list);
evsel_list = session->evlist;
ret = perf_session__process_events(session);
--
2.41.0.rc0.172.g3f132b7071-goog