All of lore.kernel.org
 help / color / mirror / Atom feed
* [PATCH 1/2] perf parse-event: Release cpu_map if evsel alloc failed
@ 2020-09-16  5:31 Namhyung Kim
  2020-09-16  5:31 ` [PATCH 2/2] perf parse-event: Fix cpu map leaks Namhyung Kim
  0 siblings, 1 reply; 4+ messages in thread
From: Namhyung Kim @ 2020-09-16  5:31 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] 4+ messages in thread

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

Thread overview: 4+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2020-09-16  5:31 [PATCH 1/2] perf parse-event: Release cpu_map if evsel alloc failed Namhyung Kim
2020-09-16  5:31 ` [PATCH 2/2] perf parse-event: Fix cpu map leaks Namhyung Kim
2020-09-16 14:00   ` Arnaldo Carvalho de Melo
2020-09-17  1:35     ` Namhyung Kim

This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.