[<prev] [next>] [thread-next>] [day] [month] [year] [list]
Message-ID: <ea548157-5cb0-ffa7-9bd5-ff3f9c66b1de@web.de>
Date: Thu, 11 Jun 2020 15:17:17 +0200
From: Markus Elfring <Markus.Elfring@....de>
To: Chen Wandun <chenwandun@...wei.com>, netdev@...r.kernel.org,
bpf@...r.kernel.org
Cc: linux-kernel@...r.kernel.org, Yonghong Song <yhs@...com>,
Song Liu <songliubraving@...com>,
Peter Zijlstra <peterz@...radead.org>,
Adrian Hunter <adrian.hunter@...el.com>,
Alexander Shishkin <alexander.shishkin@...ux.intel.com>,
Andrii Nakryiko <andriin@...com>,
Arnaldo Carvalho de Melo <acme@...nel.org>,
Cheng Jian <cj.chengjian@...wei.com>,
Daniel Borkmann <daniel@...earbox.net>,
Ian Rogers <irogers@...gle.com>,
Ingo Molnar <mingo@...hat.com>, Jiri Olsa <jolsa@...hat.com>,
John Fastabend <john.fastabend@...il.com>,
Leo Yan <leo.yan@...aro.org>,
Mark Rutland <mark.rutland@....com>,
Martin KaFai Lau <kafai@...com>,
Namhyung Kim <namhyung@...nel.org>
Subject: Re: [PATCH] perf tools: Fix potential memory leak in perf events
parser
> Fix potential memory leak in function parse_events_term__sym_hw()
> and parse_events_term__clone().
Would you like to add the tag “Fixes” to the commit message?
…
> +++ b/tools/perf/util/parse-events.c
…
> @@ -2957,9 +2958,20 @@ int parse_events_term__sym_hw(struct parse_events_term **term,
> sym = &event_symbols_hw[idx];
>
> str = strdup(sym->symbol);
> - if (!str)
> + if (!str) {
> + if (!config)
> + free(temp.config);
> return -ENOMEM;
> - return new_term(term, &temp, str, 0);
> + }
> +
> + ret = new_term(term, &temp, str, 0);
> + if (ret < 0) {
> + free(str);
> + if (!config)
> + free(temp.config);
> + }
> +
> + return ret;
> }
…
How do you think about to add jump targets for a bit of
common exception handling code in these function implementations?
Regards,
Markus
Powered by blists - more mailing lists