[<prev] [next>] [<thread-prev] [thread-next>] [day] [month] [year] [list]
Message-ID: <CAP-5=fWEQdgOsVioWEHr6QNPv81r6VjAR5vyA3OGSuF09RsXBg@mail.gmail.com>
Date: Sun, 25 Feb 2024 09:44:04 -0800
From: Ian Rogers <irogers@...gle.com>
To: Christophe JAILLET <christophe.jaillet@...adoo.fr>
Cc: Peter Zijlstra <peterz@...radead.org>, Ingo Molnar <mingo@...hat.com>,
Arnaldo Carvalho de Melo <acme@...nel.org>, Mark Rutland <mark.rutland@....com>,
Alexander Shishkin <alexander.shishkin@...ux.intel.com>, Jiri Olsa <jolsa@...nel.org>,
Namhyung Kim <namhyung@...nel.org>, Adrian Hunter <adrian.hunter@...el.com>,
linux-kernel@...r.kernel.org, kernel-janitors@...r.kernel.org,
Arnaldo Carvalho de Melo <acme@...hat.com>, linux-perf-users@...r.kernel.org
Subject: Re: [PATCH] perf pmu: Fix a potential memory leak in perf_pmu__lookup()
On Sun, Feb 25, 2024 at 7:42 AM Christophe JAILLET
<christophe.jaillet@...adoo.fr> wrote:
>
> Le 26/08/2023 à 23:32, Christophe JAILLET a écrit :
> > The commit in Fixes has reordered some code, but missed an error handling
> > path.
> >
> > 'goto err' now, in order to avoid a memory leak in case of error.
> >
> > Fixes: f63a536f03a2 ("perf pmu: Merge JSON events with sysfs at load time")
> > Signed-off-by: Christophe JAILLET <christophe.jaillet@...adoo.fr>
> > ---
>
> Hi,
>
> polite reminder.
Apologies for the delay.
Reviewed-by: Ian Rogers <irogers@...gle.com>
Thanks,
Ian
> CJ
>
>
> > tools/perf/util/pmu.c | 7 +++----
> > 1 file changed, 3 insertions(+), 4 deletions(-)
> >
> > diff --git a/tools/perf/util/pmu.c b/tools/perf/util/pmu.c
> > index bb2ca29cd7bd..8dfce84ad9fe 100644
> > --- a/tools/perf/util/pmu.c
> > +++ b/tools/perf/util/pmu.c
> > @@ -1018,10 +1018,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);
> >
>
Powered by blists - more mailing lists