[<prev] [next>] [<thread-prev] [thread-next>] [day] [month] [year] [list]
Message-ID: <20200915115901.GD720847@kernel.org>
Date: Tue, 15 Sep 2020 08:59:01 -0300
From: Arnaldo Carvalho de Melo <acme@...nel.org>
To: Namhyung Kim <namhyung@...nel.org>
Cc: Jiri Olsa <jolsa@...hat.com>, Ingo Molnar <mingo@...nel.org>,
Peter Zijlstra <a.p.zijlstra@...llo.nl>,
Mark Rutland <mark.rutland@....com>,
Alexander Shishkin <alexander.shishkin@...ux.intel.com>,
Stephane Eranian <eranian@...gle.com>,
LKML <linux-kernel@...r.kernel.org>,
Andi Kleen <ak@...ux.intel.com>,
Ian Rogers <irogers@...gle.com>,
Kajol Jain <kjain@...ux.ibm.com>,
John Garry <john.garry@...wei.com>
Subject: Re: [PATCH 02/11] perf metric: Fix some memory leaks - part 2
Em Tue, Sep 15, 2020 at 12:18:10PM +0900, Namhyung Kim escreveu:
> The metric_event_delete() missed to free expr->metric_events and it
> should free an expr when metric_refs allocation failed.
Thanks, applied.
- Arnaldo
> Cc: Kajol Jain <kjain@...ux.ibm.com>
> Cc: John Garry <john.garry@...wei.com>
> Cc: Ian Rogers <irogers@...gle.com>
> Acked-by: Jiri Olsa <jolsa@...hat.com>
> Fixes: 4ea2896715e67 ("perf metric: Collect referenced metrics in struct metric_expr")
> Signed-off-by: Namhyung Kim <namhyung@...nel.org>
> ---
> tools/perf/util/metricgroup.c | 2 ++
> 1 file changed, 2 insertions(+)
>
> diff --git a/tools/perf/util/metricgroup.c b/tools/perf/util/metricgroup.c
> index 90d14c63babb..53747df601fa 100644
> --- a/tools/perf/util/metricgroup.c
> +++ b/tools/perf/util/metricgroup.c
> @@ -84,6 +84,7 @@ static void metric_event_delete(struct rblist *rblist __maybe_unused,
>
> list_for_each_entry_safe(expr, tmp, &me->head, nd) {
> free(expr->metric_refs);
> + free(expr->metric_events);
> free(expr);
> }
>
> @@ -315,6 +316,7 @@ static int metricgroup__setup_events(struct list_head *groups,
> if (!metric_refs) {
> ret = -ENOMEM;
> free(metric_events);
> + free(expr);
> break;
> }
>
> --
> 2.28.0.618.gf4bc123cb7-goog
>
--
- Arnaldo
Powered by blists - more mailing lists