Skip to content

Commit 69d2472

Browse files
captain5050namhyung
authored andcommitted
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>
1 parent f60efb4 commit 69d2472

1 file changed

Lines changed: 4 additions & 1 deletion

File tree

tools/perf/util/mem-events.c

Lines changed: 4 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -303,12 +303,15 @@ int perf_mem_events__record_args(const char **rec_argv, int *argv_nr, char **eve
303303
}
304304

305305
if (cpu_map) {
306-
if (!perf_cpu_map__equal(cpu_map, cpu_map__online())) {
306+
struct perf_cpu_map *online = cpu_map__online();
307+
308+
if (!perf_cpu_map__equal(cpu_map, online)) {
307309
char buf[200];
308310

309311
cpu_map__snprint(cpu_map, buf, sizeof(buf));
310312
pr_warning("Memory events are enabled on a subset of CPUs: %s\n", buf);
311313
}
314+
perf_cpu_map__put(online);
312315
perf_cpu_map__put(cpu_map);
313316
}
314317

0 commit comments

Comments
 (0)