From: Arnaldo Carvalho de Melo Date: Wed, 30 Jan 2013 17:01:20 +0000 (-0300) Subject: perf top: Delete maps on exit X-Git-Tag: upstream/snapshot3+hdmi~5742^2~11^2~23 X-Git-Url: http://review.tizen.org/git/?a=commitdiff_plain;h=0de233b9c4f8c83b2cb655bfdbec306c8da81199;p=platform%2Fadaptation%2Frenesas_rcar%2Frenesas_kernel.git perf top: Delete maps on exit Removing one more memory leak found with valgrind. Cc: David Ahern Cc: Frederic Weisbecker Cc: Jiri Olsa Cc: Mike Galbraith Cc: Namhyung Kim Cc: Paul Mackerras Cc: Peter Zijlstra Cc: Stephane Eranian Link: http://lkml.kernel.org/n/tip-gnb1gms0k8wictmtm2umpr8u@git.kernel.org Signed-off-by: Arnaldo Carvalho de Melo --- diff --git a/tools/perf/builtin-top.c b/tools/perf/builtin-top.c index 903e4f4..f561757 100644 --- a/tools/perf/builtin-top.c +++ b/tools/perf/builtin-top.c @@ -1164,7 +1164,7 @@ int cmd_top(int argc, const char **argv, const char *prefix __maybe_unused) if (!top.evlist->nr_entries && perf_evlist__add_default(top.evlist) < 0) { ui__error("Not enough memory for event selector list\n"); - return -ENOMEM; + goto out_delete_maps; } symbol_conf.nr_events = top.evlist->nr_entries; @@ -1187,7 +1187,7 @@ int cmd_top(int argc, const char **argv, const char *prefix __maybe_unused) } else { ui__error("frequency and count are zero, aborting\n"); status = -EINVAL; - goto out_delete_evlist; + goto out_delete_maps; } top.sym_evsel = perf_evlist__first(top.evlist); @@ -1220,6 +1220,8 @@ int cmd_top(int argc, const char **argv, const char *prefix __maybe_unused) status = __cmd_top(&top); +out_delete_maps: + perf_evlist__delete_maps(top.evlist); out_delete_evlist: perf_evlist__delete(top.evlist);