Skip to content

Commit 70c819e

Browse files
changbinduacmel
authored andcommitted
perf top: Fix error handling in cmd_top()
We should go to the cleanup path, to avoid leaks, detected using 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: Namhyung Kim <[email protected]> Cc: Peter Zijlstra <[email protected]> Cc: Steven Rostedt (VMware) <[email protected]> Link: http://lkml.kernel.org/r/[email protected] Signed-off-by: Arnaldo Carvalho de Melo <[email protected]>
1 parent 0dba9e4 commit 70c819e

File tree

1 file changed

+3
-2
lines changed

1 file changed

+3
-2
lines changed

tools/perf/builtin-top.c

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1617,8 +1617,9 @@ int cmd_top(int argc, const char **argv)
16171617
annotation_config__init();
16181618

16191619
symbol_conf.try_vmlinux_path = (symbol_conf.vmlinux_name == NULL);
1620-
if (symbol__init(NULL) < 0)
1621-
return -1;
1620+
status = symbol__init(NULL);
1621+
if (status < 0)
1622+
goto out_delete_evlist;
16221623

16231624
sort__setup_elide(stdout);
16241625

0 commit comments

Comments
 (0)