aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorNamhyung Kim <[email protected]>2020-09-17 15:02:18 +0900
committerArnaldo Carvalho de Melo <[email protected]>2020-09-17 13:28:15 -0300
commit0f1b550e29c1f9522f0a7a11ee2cf95d33a98d79 (patch)
treef2566309d974c30c2e422f205c4387908c877689
parent5d680be3b014d5836ad6c2a8bdda70cce89dbfc8 (diff)
perf parse-event: Release cpu_map refcount if evsel alloc failed
Signed-off-by: Namhyung Kim <[email protected]> Cc: Alexander Shishkin <[email protected]> Cc: Andi Kleen <[email protected]> Cc: Ian Rogers <[email protected]> Cc: Jiri Olsa <[email protected]> Cc: Mark Rutland <[email protected]> Cc: Peter Zijlstra <[email protected]> Cc: Stephane Eranian <[email protected]> Link: http://lore.kernel.org/lkml/[email protected] Signed-off-by: Arnaldo Carvalho de Melo <[email protected]>
-rw-r--r--tools/perf/util/parse-events.c4
1 files changed, 3 insertions, 1 deletions
diff --git a/tools/perf/util/parse-events.c b/tools/perf/util/parse-events.c
index 4c6b3d287d54..fbe0d3143353 100644
--- a/tools/perf/util/parse-events.c
+++ b/tools/perf/util/parse-events.c
@@ -360,8 +360,10 @@ __add_event(struct list_head *list, int *idx,
event_attr_init(attr);
evsel = evsel__new_idx(attr, *idx);
- if (!evsel)
+ if (!evsel) {
+ perf_cpu_map__put(cpus);
return NULL;
+ }
(*idx)++;
evsel->core.cpus = cpus;