public inbox for linux-kernel@vger.kernel.org
 help / color / mirror / Atom feed
From: Jiri Olsa <jolsa@redhat.com>
To: Namhyung Kim <namhyung@kernel.org>
Cc: Arnaldo Carvalho de Melo <acme@kernel.org>,
	Ingo Molnar <mingo@kernel.org>,
	Peter Zijlstra <a.p.zijlstra@chello.nl>,
	Mark Rutland <mark.rutland@arm.com>,
	Alexander Shishkin <alexander.shishkin@linux.intel.com>,
	Stephane Eranian <eranian@google.com>,
	LKML <linux-kernel@vger.kernel.org>,
	Andi Kleen <andi@firstfloor.org>,
	Kajol Jain <kjain@linux.ibm.com>,
	John Garry <john.garry@huawei.com>,
	Ian Rogers <irogers@google.com>
Subject: Re: [PATCH v2 2/2] perf metric: Fix some memory leaks - part 2
Date: Sun, 6 Sep 2020 14:41:33 +0200	[thread overview]
Message-ID: <20200906124133.GB1199773@krava> (raw)
In-Reply-To: <20200905021912.621388-2-namhyung@kernel.org>

On Sat, Sep 05, 2020 at 11:19:12AM +0900, Namhyung Kim wrote:
> The metric_event_delete() missed to free expr->metric_events and it
> should free an expr when metric_refs allocation failed.
> 
> Cc: Kajol Jain <kjain@linux.ibm.com>
> Cc: John Garry <john.garry@huawei.com>
> Cc: Ian Rogers <irogers@google.com>
> Fixes: 4ea2896715e67 ("perf metric: Collect referenced metrics in struct metric_expr")
> Signed-off-by: Namhyung Kim <namhyung@kernel.org>

Acked-by: Jiri Olsa <jolsa@redhat.com>

thanks,
jirka

> ---
>  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 af664d6218d6..b28c09447c10 100644
> --- a/tools/perf/util/metricgroup.c
> +++ b/tools/perf/util/metricgroup.c
> @@ -85,6 +85,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);
>  	}
>  
> @@ -316,6 +317,7 @@ static int metricgroup__setup_events(struct list_head *groups,
>  			if (!metric_refs) {
>  				ret = -ENOMEM;
>  				free(metric_events);
> +				free(expr);
>  				break;
>  			}
>  
> -- 
> 2.28.0.526.ge36021eeef-goog
> 


  reply	other threads:[~2020-09-06 12:43 UTC|newest]

Thread overview: 5+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2020-09-05  2:19 [PATCH v2 1/2] perf metric: Fix some memory leaks Namhyung Kim
2020-09-05  2:19 ` [PATCH v2 2/2] perf metric: Fix some memory leaks - part 2 Namhyung Kim
2020-09-06 12:41   ` Jiri Olsa [this message]
2020-09-06 12:41 ` [PATCH v2 1/2] perf metric: Fix some memory leaks Jiri Olsa
2020-09-07  0:27   ` Namhyung Kim

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=20200906124133.GB1199773@krava \
    --to=jolsa@redhat.com \
    --cc=a.p.zijlstra@chello.nl \
    --cc=acme@kernel.org \
    --cc=alexander.shishkin@linux.intel.com \
    --cc=andi@firstfloor.org \
    --cc=eranian@google.com \
    --cc=irogers@google.com \
    --cc=john.garry@huawei.com \
    --cc=kjain@linux.ibm.com \
    --cc=linux-kernel@vger.kernel.org \
    --cc=mark.rutland@arm.com \
    --cc=mingo@kernel.org \
    --cc=namhyung@kernel.org \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox