Skip to content

Commit

Permalink
perf parse-event: Release cpu_map if evsel alloc failed
Browse files Browse the repository at this point in the history
Signed-off-by: Namhyung Kim <namhyung@kernel.org>
  • Loading branch information
namhyung authored and intel-lab-lkp committed Sep 16, 2020
1 parent 221bfce commit 48d391a
Showing 1 changed file with 3 additions and 1 deletion.
4 changes: 3 additions & 1 deletion tools/perf/util/parse-events.c
Expand Up @@ -359,8 +359,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);
Expand Down

0 comments on commit 48d391a

Please sign in to comment.