From: Namhyung Kim Date: Thu, 17 Sep 2020 06:02:18 +0000 (+0900) Subject: perf parse-event: Release cpu_map refcount if evsel alloc failed X-Git-Tag: v5.10-rc1~91^2~35^2~3 X-Git-Url: https://git.kernel.dk/?a=commitdiff_plain;h=0f1b550e29c1f9522f0a7a11ee2cf95d33a98d79;p=linux-2.6-block.git perf parse-event: Release cpu_map refcount if evsel alloc failed Signed-off-by: Namhyung Kim Cc: Alexander Shishkin Cc: Andi Kleen Cc: Ian Rogers Cc: Jiri Olsa Cc: Mark Rutland Cc: Peter Zijlstra Cc: Stephane Eranian Link: http://lore.kernel.org/lkml/20200917060219.1287863-1-namhyung@kernel.org Signed-off-by: Arnaldo Carvalho de Melo --- 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;