lkml.org 
[lkml]   [2020]   [Sep]   [16]   [last100]   RSS Feed
Views: [wrap][no wrap]   [headers]  [forward] 
 
Messages in this thread
Patch in this message
/
From
Subject[PATCH 1/2] perf parse-event: Release cpu_map if evsel alloc failed
Date
Signed-off-by: Namhyung Kim <namhyung@kernel.org>
---
tools/perf/util/parse-events.c | 4 +++-
1 file changed, 3 insertions(+), 1 deletion(-)

diff --git a/tools/perf/util/parse-events.c b/tools/perf/util/parse-events.c
index 667cbca1547a..176a51698a64 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 = perf_cpu_map__get(cpus);
--
2.28.0.618.gf4bc123cb7-goog
\
 
 \ /
  Last update: 2020-09-16 07:33    [W:0.062 / U:7.480 seconds]
©2003-2020 Jasper Spaans|hosted at Digital Ocean and TransIP|Read the blog|Advertise on this site