linux-perf-users.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
From: Arnaldo Carvalho de Melo <acme@kernel.org>
To: Yang Jihong <yangjihong1@huawei.com>
Cc: peterz@infradead.org, mingo@redhat.com, namhyung@kernel.org,
	mark.rutland@arm.com, alexander.shishkin@linux.intel.com,
	jolsa@kernel.org, irogers@google.com, adrian.hunter@intel.com,
	linux-perf-users@vger.kernel.org, linux-kernel@vger.kernel.org
Subject: Re: [PATCH 5/5] perf thread_map: Free strlist on normal path in thread_map__new_by_tid_str()
Date: Mon, 5 Feb 2024 16:09:32 -0300	[thread overview]
Message-ID: <ZcEybM9bV6vP9n7K@x1> (raw)
In-Reply-To: <20240205104616.132417-6-yangjihong1@huawei.com>

On Mon, Feb 05, 2024 at 10:46:16AM +0000, Yang Jihong wrote:
> slist needs to be freed in both error path and normal path in
> thread_map__new_by_tid_str().

Please add:

Fixes: b52956c961be3a04 ("perf tools: Allow multiple threads or processes in record, stat, top")

Reviewed-by: Arnaldo Carvalho de Melo <acme@redhat.com>

- Arnaldo
 
> Signed-off-by: Yang Jihong <yangjihong1@huawei.com>
> ---
>  tools/perf/util/thread_map.c | 2 +-
>  1 file changed, 1 insertion(+), 1 deletion(-)
> 
> diff --git a/tools/perf/util/thread_map.c b/tools/perf/util/thread_map.c
> index e848579e61a8..ea3b431b9783 100644
> --- a/tools/perf/util/thread_map.c
> +++ b/tools/perf/util/thread_map.c
> @@ -280,13 +280,13 @@ struct perf_thread_map *thread_map__new_by_tid_str(const char *tid_str)
>  		threads->nr = ntasks;
>  	}
>  out:
> +	strlist__delete(slist);
>  	if (threads)
>  		refcount_set(&threads->refcnt, 1);
>  	return threads;
>  
>  out_free_threads:
>  	zfree(&threads);
> -	strlist__delete(slist);
>  	goto out;
>  }
>  
> -- 
> 2.34.1

  reply	other threads:[~2024-02-05 19:09 UTC|newest]

Thread overview: 12+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2024-02-05 10:46 [PATCH 0/5] perf sched: Minor optimizations for resource initialization Yang Jihong
2024-02-05 10:46 ` [PATCH 1/5] perf sched: Move start_work_mutex and work_done_wait_mutex initialization to perf_sched__replay() Yang Jihong
2024-02-05 10:46 ` [PATCH 2/5] perf sched: Fix memory leak in perf_sched__map() Yang Jihong
2024-02-05 18:58   ` Arnaldo Carvalho de Melo
2024-02-06  7:08     ` Yang Jihong
2024-02-05 10:46 ` [PATCH 3/5] perf sched: Move curr_thread initialization to perf_sched__map() Yang Jihong
2024-02-05 18:59   ` Arnaldo Carvalho de Melo
2024-02-05 10:46 ` [PATCH 4/5] perf sched: Move curr_pid and cpu_last_switched initialization to perf_sched__{lat|map|replay}() Yang Jihong
2024-02-05 19:01   ` Arnaldo Carvalho de Melo
2024-02-05 10:46 ` [PATCH 5/5] perf thread_map: Free strlist on normal path in thread_map__new_by_tid_str() Yang Jihong
2024-02-05 19:09   ` Arnaldo Carvalho de Melo [this message]
2024-02-06  7:10     ` Yang Jihong

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=ZcEybM9bV6vP9n7K@x1 \
    --to=acme@kernel.org \
    --cc=adrian.hunter@intel.com \
    --cc=alexander.shishkin@linux.intel.com \
    --cc=irogers@google.com \
    --cc=jolsa@kernel.org \
    --cc=linux-kernel@vger.kernel.org \
    --cc=linux-perf-users@vger.kernel.org \
    --cc=mark.rutland@arm.com \
    --cc=mingo@redhat.com \
    --cc=namhyung@kernel.org \
    --cc=peterz@infradead.org \
    --cc=yangjihong1@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 a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).