Skip to content

Commit cb6186a

Browse files
changbinduacmel
authored andcommitted
perf hist: Add missing map__put() in error case
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]>
1 parent 70c819e commit cb6186a

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
@@ -1111,8 +1111,10 @@ int hist_entry_iter__add(struct hist_entry_iter *iter, struct addr_location *al,
11111111

11121112
err = sample__resolve_callchain(iter->sample, &callchain_cursor, &iter->parent,
11131113
iter->evsel, al, max_stack_depth);
1114-
if (err)
1114+
if (err) {
1115+
map__put(alm);
11151116
return err;
1117+
}
11161118

11171119
err = iter->ops->prepare_entry(iter, al);
11181120
if (err)

0 commit comments

Comments
 (0)