perf dso: Add missed dso__put to dso__load_kcore
authorIan Rogers <irogers@google.com>
Tue, 24 Jun 2025 19:03:21 +0000 (12:03 -0700)
committerNamhyung Kim <namhyung@kernel.org>
Thu, 3 Jul 2025 02:05:26 +0000 (19:05 -0700)
The kcore loading creates a set of list nodes that have reference
counted references to maps of the kcore. The list node freeing in the
success path wasn't releasing the maps, add the missing puts. It is
unclear why this leak was being missed by leak sanitizer.

Fixes: 83720209961f ("perf map: Move map list node into symbol")
Signed-off-by: Ian Rogers <irogers@google.com>
Link: https://lore.kernel.org/r/20250624190326.2038704-2-irogers@google.com
Signed-off-by: Namhyung Kim <namhyung@kernel.org>
tools/perf/util/symbol.c

index 73dab94fab74e829fa296960c51b79dc228bddc2..ae0bd568ac458df85d50461a4d18242e9c9ac572 100644 (file)
@@ -1422,6 +1422,7 @@ static int dso__load_kcore(struct dso *dso, struct map *map,
                                goto out_err;
                        }
                }
+               map__zput(new_node->map);
                free(new_node);
        }