All of lore.kernel.org
 help / color / mirror / Atom feed
From: Ian Rogers <irogers@google.com>
To: Arnaldo Carvalho de Melo <acme@kernel.org>
Cc: Wei Li <liwei391@huawei.com>,
	Alexander Shishkin <alexander.shishkin@linux.intel.com>,
	Jiri Olsa <jolsa@redhat.com>, Mark Rutland <mark.rutland@arm.com>,
	Namhyung Kim <namhyung@kernel.org>,
	LKML <linux-kernel@vger.kernel.org>,
	Li Bin <huawei.libin@huawei.com>, Xie XiuQi <xiexiuqi@huawei.com>,
	Hongbo Yao <yaohongbo@huawei.com>
Subject: Re: [PATCH 1/4] perf metrictroup: Fix memory leak of metric_events
Date: Thu, 21 May 2020 09:10:55 -0700	[thread overview]
Message-ID: <CAP-5=fWe-74NG1YBS2g2okgNMvScPD6qFh-n8jr_YbzdTug44Q@mail.gmail.com> (raw)
In-Reply-To: <20200521155400.GA14034@kernel.org>

On Thu, May 21, 2020 at 8:54 AM Arnaldo Carvalho de Melo
<acme@kernel.org> wrote:
>
> Em Thu, May 21, 2020 at 09:32:15PM +0800, Wei Li escreveu:
> > From: Hongbo Yao <yaohongbo@huawei.com>
> >
> > Fix memory leak of metric_events in function metricgroup__setup_events()
>
> The leak is there but this code has changed a lot recently, please take
> a look at my perf/core branch and keep Ian Rogers in the loop,
>
> - Arnaldo

Thanks, I'd posted the same change here:
https://lore.kernel.org/lkml/20200508053629.210324-10-irogers@google.com/
but it looks like it was mislaid. Arnaldo, I can re-post that patch or
Acked-by this patch. I'm easy either way.

Thanks,
Ian

> > Signed-off-by: Hongbo Yao <yaohongbo@huawei.com>
> > ---
> >  tools/perf/util/metricgroup.c | 3 +++
> >  1 file changed, 3 insertions(+)
> >
> > diff --git a/tools/perf/util/metricgroup.c b/tools/perf/util/metricgroup.c
> > index 926449a7cdbf..69bf0f4d646e 100644
> > --- a/tools/perf/util/metricgroup.c
> > +++ b/tools/perf/util/metricgroup.c
> > @@ -184,6 +184,7 @@ static int metricgroup__setup_events(struct list_head *groups,
> >               if (!evsel) {
> >                       pr_debug("Cannot resolve %s: %s\n",
> >                                       eg->metric_name, eg->metric_expr);
> > +                     free(metric_events);
> >                       continue;
> >               }
> >               for (i = 0; i < eg->idnum; i++)
> > @@ -191,11 +192,13 @@ static int metricgroup__setup_events(struct list_head *groups,
> >               me = metricgroup__lookup(metric_events_list, evsel, true);
> >               if (!me) {
> >                       ret = -ENOMEM;
> > +                     free(metric_events);
> >                       break;
> >               }
> >               expr = malloc(sizeof(struct metric_expr));
> >               if (!expr) {
> >                       ret = -ENOMEM;
> > +                     free(metric_events);
> >                       break;
> >               }
> >               expr->metric_expr = eg->metric_expr;
> > --
> > 2.17.1
> >
>
> --
>
> - Arnaldo

  reply	other threads:[~2020-05-21 16:11 UTC|newest]

Thread overview: 10+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2020-05-21 13:32 [PATCH 0/4] perf: Fix memory errors Wei Li
2020-05-21 13:32 ` [PATCH 1/4] perf metrictroup: Fix memory leak of metric_events Wei Li
2020-05-21 15:54   ` Arnaldo Carvalho de Melo
2020-05-21 16:10     ` Ian Rogers [this message]
2020-05-21 13:32 ` [PATCH 2/4] perf svghelper: Fix memory leak in svg_build_topology_map Wei Li
2020-05-21 14:15   ` Arnaldo Carvalho de Melo
2020-06-03  3:03     ` LiBin (Huawei)
2020-05-21 13:32 ` [PATCH 3/4] perf util: Fix memory leak of prefix_if_not_in Wei Li
2020-05-21 14:39   ` Arnaldo Carvalho de Melo
2020-05-21 13:32 ` [PATCH 4/4] perf util: Fix potential segment fault in put_tracepoints_path Wei Li

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='CAP-5=fWe-74NG1YBS2g2okgNMvScPD6qFh-n8jr_YbzdTug44Q@mail.gmail.com' \
    --to=irogers@google.com \
    --cc=acme@kernel.org \
    --cc=alexander.shishkin@linux.intel.com \
    --cc=huawei.libin@huawei.com \
    --cc=jolsa@redhat.com \
    --cc=linux-kernel@vger.kernel.org \
    --cc=liwei391@huawei.com \
    --cc=mark.rutland@arm.com \
    --cc=namhyung@kernel.org \
    --cc=xiexiuqi@huawei.com \
    --cc=yaohongbo@huawei.com \
    /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 an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.