perf thread_map: Free strlist on normal path in thread_map__new_by_tid_str()

BugLink: https://bugs.launchpad.net/bugs/2060097

[ Upstream commit 1eb3d924e3c0b8c27388b0583a989d757866efb6 ]

slist needs to be freed in both error path and normal path in
thread_map__new_by_tid_str().

Fixes: b52956c961 ("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>
(cherry picked from commit 6a480b3ad283b1691d1940800864abd436c47355)
Signed-off-by: Paolo Pisati <paolo.pisati@canonical.com>
This commit is contained in:
Yang Jihong
2024-02-06 08:32:28 +00:00
committed by Roxana Nicolescu
parent c449b3b414
commit d1498d3919
+1 -1
View File
@@ -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;
}