perf parse-event: Fix cpu map refcounting
[linux-2.6-microblaze.git] / tools / perf / util / parse-events.c
index 667cbca..4c6b3d2 100644 (file)
@@ -353,7 +353,7 @@ __add_event(struct list_head *list, int *idx,
            const char *cpu_list)
 {
        struct evsel *evsel;
-       struct perf_cpu_map *cpus = pmu ? pmu->cpus :
+       struct perf_cpu_map *cpus = pmu ? perf_cpu_map__get(pmu->cpus) :
                               cpu_list ? perf_cpu_map__new(cpu_list) : NULL;
 
        if (init_attr)
@@ -364,7 +364,7 @@ __add_event(struct list_head *list, int *idx,
                return NULL;
 
        (*idx)++;
-       evsel->core.cpus   = perf_cpu_map__get(cpus);
+       evsel->core.cpus = cpus;
        evsel->core.own_cpus = perf_cpu_map__get(cpus);
        evsel->core.system_wide = pmu ? pmu->is_uncore : false;
        evsel->auto_merge_stats = auto_merge_stats;