[PATCH v2 2/7] perf stat: Drop CPU and thread map references on report exit

From: Leo Yan

Date: Fri Dec 04 2026 - 06:24:06 EST


perf_evlist__set_maps() takes references to the CPU and thread maps read
from the recording. Put both the cpu and thread maps after event
processing.

Fixes: a55e56637613 ("perf evlist: Reference count the cpu and thread maps at set_maps()")
Closes: https://sashiko.dev/#/bug/linux-b77574e3-cc57-4338-8810-73a0cfa6fff7
Signed-off-by: Leo Yan <leo.yan@xxxxxxx>
---
tools/perf/builtin-stat.c | 2 ++
1 file changed, 2 insertions(+)

diff --git a/tools/perf/builtin-stat.c b/tools/perf/builtin-stat.c
index 1d440d66cc3eb76c3a461445042fed3d65d8d570..92892581ccdcb28f20737f94b72406432b67e316 100644
--- a/tools/perf/builtin-stat.c
+++ b/tools/perf/builtin-stat.c
@@ -2419,6 +2419,8 @@ static int __cmd_report(int argc, const char **argv)

ret = perf_session__process_events(session);

+ perf_thread_map__put(perf_stat.threads);
+ perf_cpu_map__put(perf_stat.cpus);
perf_stat__exit_aggr_mode();
perf_session__delete(session);
return ret;

--
2.34.1