aboutsummaryrefslogtreecommitdiffstats
path: root/tools/perf
diff options
context:
space:
mode:
authorStanislav Fomichev <stfomichev@yandex-team.ru>2014-01-20 06:39:39 -0500
committerArnaldo Carvalho de Melo <acme@redhat.com>2014-01-20 14:19:08 -0500
commit8bac41cbfe2efe55e2b93673b84761ed7dd75f69 (patch)
treeca21eed8c6898078df9fedba67661a6e3f8cd7dc /tools/perf
parent3415d8b851307c75a1e8aa16030db9172306df78 (diff)
perf session: Free cpu_map in perf_session__cpu_bitmap
This method uses a temporary struct cpu_map to figure out the cpus present in the received cpu list in string form, but it failed to free it after returning. Fix it. Signed-off-by: Stanislav Fomichev <stfomichev@yandex-team.ru> Cc: Adrian Hunter <adrian.hunter@intel.com> Cc: David Ahern <dsahern@gmail.com> Cc: Ingo Molnar <mingo@redhat.com> Cc: Jiri Olsa <jolsa@redhat.com> Cc: Namhyung Kim <namhyung@kernel.org> Cc: Paul Mackerras <paulus@samba.org> Cc: Peter Zijlstra <a.p.zijlstra@chello.nl> Link: http://lkml.kernel.org/r/1390217980-22424-3-git-send-email-stfomichev@yandex-team.ru [ Use goto + err = -1 to do the delete just once, in the normal exit path ] Signed-off-by: Arnaldo Carvalho de Melo <acme@redhat.com>
Diffstat (limited to 'tools/perf')
-rw-r--r--tools/perf/util/session.c10
1 files changed, 7 insertions, 3 deletions
diff --git a/tools/perf/util/session.c b/tools/perf/util/session.c
index 7acc03e8f3b2..0b39a48e5110 100644
--- a/tools/perf/util/session.c
+++ b/tools/perf/util/session.c
@@ -1573,7 +1573,7 @@ next:
1573int perf_session__cpu_bitmap(struct perf_session *session, 1573int perf_session__cpu_bitmap(struct perf_session *session,
1574 const char *cpu_list, unsigned long *cpu_bitmap) 1574 const char *cpu_list, unsigned long *cpu_bitmap)
1575{ 1575{
1576 int i; 1576 int i, err = -1;
1577 struct cpu_map *map; 1577 struct cpu_map *map;
1578 1578
1579 for (i = 0; i < PERF_TYPE_MAX; ++i) { 1579 for (i = 0; i < PERF_TYPE_MAX; ++i) {
@@ -1602,13 +1602,17 @@ int perf_session__cpu_bitmap(struct perf_session *session,
1602 if (cpu >= MAX_NR_CPUS) { 1602 if (cpu >= MAX_NR_CPUS) {
1603 pr_err("Requested CPU %d too large. " 1603 pr_err("Requested CPU %d too large. "
1604 "Consider raising MAX_NR_CPUS\n", cpu); 1604 "Consider raising MAX_NR_CPUS\n", cpu);
1605 return -1; 1605 goto out_delete_map;
1606 } 1606 }
1607 1607
1608 set_bit(cpu, cpu_bitmap); 1608 set_bit(cpu, cpu_bitmap);
1609 } 1609 }
1610 1610
1611 return 0; 1611 err = 0;
1612
1613out_delete_map:
1614 cpu_map__delete(map);
1615 return err;
1612} 1616}
1613 1617
1614void perf_session__fprintf_info(struct perf_session *session, FILE *fp, 1618void perf_session__fprintf_info(struct perf_session *session, FILE *fp,