Skip to content

Commit ff22178

Browse files
changbindugregkh
authored andcommitted
perf hist: Add missing map__put() in error case
[ Upstream commit cb6186a ] We need to map__put() before returning from failure of sample__resolve_callchain(). Detected with gcc's ASan. Signed-off-by: Changbin Du <[email protected]> Reviewed-by: Jiri Olsa <[email protected]> Cc: Alexei Starovoitov <[email protected]> Cc: Daniel Borkmann <[email protected]> Cc: Krister Johansen <[email protected]> Cc: Namhyung Kim <[email protected]> Cc: Peter Zijlstra <[email protected]> Cc: Steven Rostedt (VMware) <[email protected]> Fixes: 9c68ae9 ("perf callchain: Reference count maps") Link: http://lkml.kernel.org/r/[email protected] Signed-off-by: Arnaldo Carvalho de Melo <[email protected]> Signed-off-by: Sasha Levin <[email protected]>
1 parent dac5fed commit ff22178

File tree

1 file changed

+3
-1
lines changed

1 file changed

+3
-1
lines changed

tools/perf/util/hist.c

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1040,8 +1040,10 @@ int hist_entry_iter__add(struct hist_entry_iter *iter, struct addr_location *al,
10401040

10411041
err = sample__resolve_callchain(iter->sample, &callchain_cursor, &iter->parent,
10421042
iter->evsel, al, max_stack_depth);
1043-
if (err)
1043+
if (err) {
1044+
map__put(alm);
10441045
return err;
1046+
}
10451047

10461048
err = iter->ops->prepare_entry(iter, al);
10471049
if (err)

0 commit comments

Comments
 (0)