ams and so ams->ms.map is an in argument, however, it is also overwritten. As a map is reference counted, ensure a map__put is done before overwriting it.
Signed-off-by: Ian Rogers <[email protected]> Fixes: 42fd623b58db ("perf maps: Get map before returning in maps__find") --- tools/perf/util/maps.c | 1 + 1 file changed, 1 insertion(+) diff --git a/tools/perf/util/maps.c b/tools/perf/util/maps.c index 8ccc46d515b6..4092211cff62 100644 --- a/tools/perf/util/maps.c +++ b/tools/perf/util/maps.c @@ -708,6 +708,7 @@ int maps__find_ams(struct maps *maps, struct addr_map_symbol *ams) if (ams->addr < map__start(ams->ms.map) || ams->addr >= map__end(ams->ms.map)) { if (maps == NULL) return -1; + map__put(ams->ms.map); ams->ms.map = maps__find(maps, ams->addr); if (ams->ms.map == NULL) return -1; -- 2.52.0.457.g6b5491de43-goog
