[<prev] [next>] [<thread-prev] [day] [month] [year] [list]
Message-ID: <20200521170704.GC14034@kernel.org>
Date: Thu, 21 May 2020 14:07:04 -0300
From: Arnaldo Carvalho de Melo <acme@...nel.org>
To: Ian Rogers <irogers@...gle.com>
Cc: Peter Zijlstra <peterz@...radead.org>,
Ingo Molnar <mingo@...hat.com>,
Mark Rutland <mark.rutland@....com>,
Alexander Shishkin <alexander.shishkin@...ux.intel.com>,
Jiri Olsa <jolsa@...hat.com>,
Namhyung Kim <namhyung@...nel.org>,
Alexei Starovoitov <ast@...nel.org>,
Daniel Borkmann <daniel@...earbox.net>,
Martin KaFai Lau <kafai@...com>,
Song Liu <songliubraving@...com>, Yonghong Song <yhs@...com>,
Andrii Nakryiko <andriin@...com>,
John Fastabend <john.fastabend@...il.com>,
KP Singh <kpsingh@...omium.org>,
Kajol Jain <kjain@...ux.ibm.com>,
Andi Kleen <ak@...ux.intel.com>,
John Garry <john.garry@...wei.com>,
Jin Yao <yao.jin@...ux.intel.com>,
Kan Liang <kan.liang@...ux.intel.com>,
Cong Wang <xiyou.wangcong@...il.com>,
Kim Phillips <kim.phillips@....com>,
linux-kernel@...r.kernel.org, netdev@...r.kernel.org,
bpf@...r.kernel.org, linux-perf-users@...r.kernel.org,
Vince Weaver <vincent.weaver@...ne.edu>,
Stephane Eranian <eranian@...gle.com>
Subject: Re: [RFC PATCH v3 09/14] perf metricgroup: free metric_events on
error
Em Thu, May 07, 2020 at 10:36:24PM -0700, Ian Rogers escreveu:
> Avoid a simple memory leak.
Thanks, applied.
- Arnaldo
> Signed-off-by: Ian Rogers <irogers@...gle.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 4f7e36bc49d9..7e1725d61c39 100644
> --- a/tools/perf/util/metricgroup.c
> +++ b/tools/perf/util/metricgroup.c
> @@ -186,6 +186,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; metric_events[i]; i++)
> @@ -193,11 +194,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.26.2.645.ge9eca65c58-goog
>
--
- Arnaldo
Powered by blists - more mailing lists