diff --git a/tools/perf/util/pmu.c b/tools/perf/util/pmu.c index a3c7814116c7..86bfdf5db213 100644 --- a/tools/perf/util/pmu.c +++ b/tools/perf/util/pmu.c @@ -992,10 +992,9 @@ struct perf_pmu *perf_pmu__lookup(struct list_head *pmus, int dirfd, const char * type value and format definitions. Load both right * now. */ - if (pmu_format(pmu, dirfd, name)) { - free(pmu); - return NULL; - } + if (pmu_format(pmu, dirfd, name)) + goto err; + pmu->is_core = is_pmu_core(name); pmu->cpus = pmu_cpumask(dirfd, name, pmu->is_core);