]> git.ipfire.org Git - thirdparty/linux.git/commitdiff
perf hist: In init, ensure mem_info is put on error paths
authorIan Rogers <irogers@google.com>
Sat, 22 Nov 2025 08:19:18 +0000 (00:19 -0800)
committerNamhyung Kim <namhyung@kernel.org>
Wed, 3 Dec 2025 19:07:40 +0000 (11:07 -0800)
Rather than exit the internal map_symbols directly, put the mem-info
that does this and also lowers the reference count on the mem-info
itself otherwise the mem-info is being leaked.

Fixes: 56e144fe98260a0f ("perf mem_info: Add and use map_symbol__exit and addr_map_symbol__exit")
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>
tools/perf/util/hist.c

index 64ff427040c341127e8690dc438e4d0119c69aac..ef4b569f7df46336c047d04fb75462cb28701fca 100644 (file)
@@ -608,10 +608,8 @@ err_infos:
                map_symbol__exit(&he->branch_info->to.ms);
                zfree(&he->branch_info);
        }
-       if (he->mem_info) {
-               map_symbol__exit(&mem_info__iaddr(he->mem_info)->ms);
-               map_symbol__exit(&mem_info__daddr(he->mem_info)->ms);
-       }
+       if (he->mem_info)
+               mem_info__zput(he->mem_info);
 err:
        map_symbol__exit(&he->ms);
        zfree(&he->stat_acc);