perf mem-events: Don't leak online CPU map

Reference count checking found the online CPU map was being gotten but
not put. Add in the missing put.

Signed-off-by: Ian Rogers <irogers@google.com>
Reviewed-by: Arnaldo Carvalho de Melo <acme@redhat.com>
Signed-off-by: Namhyung Kim <namhyung@kernel.org>
This commit is contained in:
Ian Rogers 2025-11-22 00:19:19 -08:00 committed by Namhyung Kim
parent f60efb4454
commit 69d247295a

View File

@ -303,12 +303,15 @@ int perf_mem_events__record_args(const char **rec_argv, int *argv_nr, char **eve
}
if (cpu_map) {
if (!perf_cpu_map__equal(cpu_map, cpu_map__online())) {
struct perf_cpu_map *online = cpu_map__online();
if (!perf_cpu_map__equal(cpu_map, online)) {
char buf[200];
cpu_map__snprint(cpu_map, buf, sizeof(buf));
pr_warning("Memory events are enabled on a subset of CPUs: %s\n", buf);
}
perf_cpu_map__put(online);
perf_cpu_map__put(cpu_map);
}