Skip to content

Commit f60efb4

Browse files
captain5050namhyung
authored andcommitted
perf hist: In init, ensure mem_info is put on error paths
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>
1 parent dc4d165 commit f60efb4

1 file changed

Lines changed: 2 additions & 4 deletions

File tree

tools/perf/util/hist.c

Lines changed: 2 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -608,10 +608,8 @@ static int hist_entry__init(struct hist_entry *he,
608608
map_symbol__exit(&he->branch_info->to.ms);
609609
zfree(&he->branch_info);
610610
}
611-
if (he->mem_info) {
612-
map_symbol__exit(&mem_info__iaddr(he->mem_info)->ms);
613-
map_symbol__exit(&mem_info__daddr(he->mem_info)->ms);
614-
}
611+
if (he->mem_info)
612+
mem_info__zput(he->mem_info);
615613
err:
616614
map_symbol__exit(&he->ms);
617615
zfree(&he->stat_acc);

0 commit comments

Comments
 (0)