Linux kernel mirror (for testing) git.kernel.org/pub/scm/linux/kernel/git/torvalds/linux.git
kernel os linux

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: 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>

authored by

Ian Rogers and committed by
Namhyung Kim
f60efb44 dc4d1654

+2 -4
+2 -4
tools/perf/util/hist.c
··· 608 608 map_symbol__exit(&he->branch_info->to.ms); 609 609 zfree(&he->branch_info); 610 610 } 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); 615 613 err: 616 614 map_symbol__exit(&he->ms); 617 615 zfree(&he->stat_acc);