public inbox for linux-kernel@vger.kernel.org
 help / color / mirror / Atom feed
* [PATCH v2 1/2] perf parse-event: Release cpu_map if evsel alloc failed
@ 2020-09-17  6:02 Namhyung Kim
  2020-09-17  6:02 ` [PATCH v2 2/2] perf parse-event: Fix cpu map leaks Namhyung Kim
  2020-09-17 13:10 ` [PATCH v2 1/2] perf parse-event: Release cpu_map if evsel alloc failed Jiri Olsa
  0 siblings, 2 replies; 7+ messages in thread
From: Namhyung Kim @ 2020-09-17  6:02 UTC (permalink / raw)
  To: Arnaldo Carvalho de Melo, Jiri Olsa
  Cc: Ingo Molnar, Peter Zijlstra, Mark Rutland, Alexander Shishkin,
	Stephane Eranian, LKML, Andi Kleen, Ian Rogers

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


^ permalink raw reply related	[flat|nested] 7+ messages in thread

end of thread, other threads:[~2020-09-18  1:51 UTC | newest]

Thread overview: 7+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2020-09-17  6:02 [PATCH v2 1/2] perf parse-event: Release cpu_map if evsel alloc failed Namhyung Kim
2020-09-17  6:02 ` [PATCH v2 2/2] perf parse-event: Fix cpu map leaks Namhyung Kim
2020-09-17 16:27   ` Arnaldo Carvalho de Melo
2020-09-17 13:10 ` [PATCH v2 1/2] perf parse-event: Release cpu_map if evsel alloc failed Jiri Olsa
2020-09-17 13:27   ` Namhyung Kim
2020-09-17 16:30   ` Arnaldo Carvalho de Melo
2020-09-18  1:51     ` Namhyung Kim

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox