Skip to content

Commit 495f3e9

Browse files
captain5050gregkh
authored andcommitted
perf hist: In init, ensure mem_info is put on error paths
[ Upstream commit f60efb4 ] 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: 56e144f ("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> Signed-off-by: Sasha Levin <sashal@kernel.org>
1 parent e8097bd commit 495f3e9

File tree

1 file changed

+2
-4
lines changed

1 file changed

+2
-4
lines changed

tools/perf/util/hist.c

Lines changed: 2 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -528,10 +528,8 @@ static int hist_entry__init(struct hist_entry *he,
528528
map_symbol__exit(&he->branch_info->to.ms);
529529
zfree(&he->branch_info);
530530
}
531-
if (he->mem_info) {
532-
map_symbol__exit(&mem_info__iaddr(he->mem_info)->ms);
533-
map_symbol__exit(&mem_info__daddr(he->mem_info)->ms);
534-
}
531+
if (he->mem_info)
532+
mem_info__zput(he->mem_info);
535533
err:
536534
map_symbol__exit(&he->ms);
537535
zfree(&he->stat_acc);

0 commit comments

Comments
 (0)