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 <ak@linux.intel.com>, Ian Rogers <irogers@google.com>
Subject: Re: [PATCH v2 1/2] perf parse-event: Release cpu_map if evsel alloc failed
Date: Thu, 17 Sep 2020 15:10:58 +0200	[thread overview]
Message-ID: <20200917131058.GA2514666@krava> (raw)
In-Reply-To: <20200917060219.1287863-1-namhyung@kernel.org>

On Thu, Sep 17, 2020 at 03:02:18PM +0900, Namhyung Kim wrote:
> Signed-off-by: Namhyung Kim <namhyung@kernel.org>
> ---
>  tools/perf/util/parse-events.c | 4 +++-
>  1 file changed, 3 insertions(+), 1 deletion(-)
> 
> diff --git a/tools/perf/util/parse-events.c b/tools/perf/util/parse-events.c
> index 667cbca1547a..176a51698a64 100644
> --- a/tools/perf/util/parse-events.c
> +++ b/tools/perf/util/parse-events.c
> @@ -360,8 +360,10 @@ __add_event(struct list_head *list, int *idx,
>  		event_attr_init(attr);
>  
>  	evsel = evsel__new_idx(attr, *idx);
> -	if (!evsel)
> +	if (!evsel) {
> +		perf_cpu_map__put(cpus);

if there's pmu defined, we don't we get on perf_cpu_map:

        struct perf_cpu_map *cpus = pmu ? pmu->cpus :
                               cpu_list ? perf_cpu_map__new(cpu_list) : NULL;

jirka

>  		return NULL;
> +	}
>  
>  	(*idx)++;
>  	evsel->core.cpus   = perf_cpu_map__get(cpus);
> -- 
> 2.28.0.618.gf4bc123cb7-goog
> 


  parent reply	other threads:[~2020-09-17 13:12 UTC|newest]

Thread overview: 7+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2020-09-17  6:02 [PATCH v2 1/2] perf parse-event: Release cpu_map if evsel alloc failed Namhyung Kim
2020-09-17  6:02 ` [PATCH v2 2/2] perf parse-event: Fix cpu map leaks Namhyung Kim
2020-09-17 16:27   ` Arnaldo Carvalho de Melo
2020-09-17 13:10 ` Jiri Olsa [this message]
2020-09-17 13:27   ` [PATCH v2 1/2] perf parse-event: Release cpu_map if evsel alloc failed Namhyung Kim
2020-09-17 16:30   ` Arnaldo Carvalho de Melo
2020-09-18  1:51     ` 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=20200917131058.GA2514666@krava \
    --to=jolsa@redhat.com \
    --cc=a.p.zijlstra@chello.nl \
    --cc=acme@kernel.org \
    --cc=ak@linux.intel.com \
    --cc=alexander.shishkin@linux.intel.com \
    --cc=eranian@google.com \
    --cc=irogers@google.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