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 <changbin.du@gmail.com> Reviewed-by: Jiri Olsa <jolsa@kernel.org> Cc: Alexei Starovoitov <ast@kernel.org> Cc: Daniel Borkmann <daniel@iogearbox.net> Cc: Krister Johansen <kjlx@templeofstupid.com> Cc: Namhyung Kim <namhyung@kernel.org> Cc: Peter Zijlstra <peterz@infradead.org> Cc: Steven Rostedt (VMware) <rostedt@goodmis.org> Fixes: 9c68ae9 ("perf callchain: Reference count maps") Link: http://lkml.kernel.org/r/20190316080556.3075-10-changbin.du@gmail.com Signed-off-by: Arnaldo Carvalho de Melo <acme@redhat.com> Signed-off-by: Sasha Levin <sashal@kernel.org>
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)