summaryrefslogtreecommitdiff
path: root/tools
diff options
context:
space:
mode:
authorYang Jihong <yangjihong1@huawei.com>2024-02-06 11:32:28 +0300
committerSasha Levin <sashal@kernel.org>2024-03-27 01:22:39 +0300
commitf9e92ad5eb0901cacac8f1cc4e5ea12514f7934b (patch)
tree0b356fd40fa246655787192d64f9d72af64fde07 /tools
parent06172dff9a47e76dfce9b60d44ef21131b417803 (diff)
downloadlinux-f9e92ad5eb0901cacac8f1cc4e5ea12514f7934b.tar.xz
perf thread_map: Free strlist on normal path in thread_map__new_by_tid_str()
[ Upstream commit 1eb3d924e3c0b8c27388b0583a989d757866efb6 ] slist needs to be freed in both error path and normal path in thread_map__new_by_tid_str(). Fixes: b52956c961be3a04 ("perf tools: Allow multiple threads or processes in record, stat, top") Reviewed-by: Arnaldo Carvalho de Melo <acme@redhat.com> Signed-off-by: Yang Jihong <yangjihong1@huawei.com> Signed-off-by: Namhyung Kim <namhyung@kernel.org> Link: https://lore.kernel.org/r/20240206083228.172607-6-yangjihong1@huawei.com Signed-off-by: Sasha Levin <sashal@kernel.org>
Diffstat (limited to 'tools')
-rw-r--r--tools/perf/util/thread_map.c2
1 files changed, 1 insertions, 1 deletions
diff --git a/tools/perf/util/thread_map.c b/tools/perf/util/thread_map.c
index 5d467d8ae9ab..6ee38f245804 100644
--- a/tools/perf/util/thread_map.c
+++ b/tools/perf/util/thread_map.c
@@ -313,13 +313,13 @@ struct 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;
}