aboutsummaryrefslogtreecommitdiffstats
path: root/tools/perf
diff options
context:
space:
mode:
authorArnaldo Carvalho de Melo <acme@redhat.com>2013-01-30 12:01:20 -0500
committerArnaldo Carvalho de Melo <acme@redhat.com>2013-01-31 11:07:43 -0500
commit0de233b9c4f8c83b2cb655bfdbec306c8da81199 (patch)
treefde2a051187b86a31631bc9c2aca3a40b2a467c7 /tools/perf
parent11859e821761e9738c4d8a0e7d6ca1cc2e0d37e8 (diff)
perf top: Delete maps on exit
Removing one more memory leak found with valgrind. Cc: David Ahern <dsahern@gmail.com> Cc: Frederic Weisbecker <fweisbec@gmail.com> Cc: Jiri Olsa <jolsa@redhat.com> Cc: Mike Galbraith <efault@gmx.de> Cc: Namhyung Kim <namhyung@gmail.com> Cc: Paul Mackerras <paulus@samba.org> Cc: Peter Zijlstra <peterz@infradead.org> Cc: Stephane Eranian <eranian@google.com> Link: http://lkml.kernel.org/n/tip-gnb1gms0k8wictmtm2umpr8u@git.kernel.org Signed-off-by: Arnaldo Carvalho de Melo <acme@redhat.com>
Diffstat (limited to 'tools/perf')
-rw-r--r--tools/perf/builtin-top.c6
1 files changed, 4 insertions, 2 deletions
diff --git a/tools/perf/builtin-top.c b/tools/perf/builtin-top.c
index 903e4f4a3047..f561757b1bfa 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)
1164 if (!top.evlist->nr_entries && 1164 if (!top.evlist->nr_entries &&
1165 perf_evlist__add_default(top.evlist) < 0) { 1165 perf_evlist__add_default(top.evlist) < 0) {
1166 ui__error("Not enough memory for event selector list\n"); 1166 ui__error("Not enough memory for event selector list\n");
1167 return -ENOMEM; 1167 goto out_delete_maps;
1168 } 1168 }
1169 1169
1170 symbol_conf.nr_events = top.evlist->nr_entries; 1170 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)
1187 } else { 1187 } else {
1188 ui__error("frequency and count are zero, aborting\n"); 1188 ui__error("frequency and count are zero, aborting\n");
1189 status = -EINVAL; 1189 status = -EINVAL;
1190 goto out_delete_evlist; 1190 goto out_delete_maps;
1191 } 1191 }
1192 1192
1193 top.sym_evsel = perf_evlist__first(top.evlist); 1193 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)
1220 1220
1221 status = __cmd_top(&top); 1221 status = __cmd_top(&top);
1222 1222
1223out_delete_maps:
1224 perf_evlist__delete_maps(top.evlist);
1223out_delete_evlist: 1225out_delete_evlist:
1224 perf_evlist__delete(top.evlist); 1226 perf_evlist__delete(top.evlist);
1225 1227