Commit 1eb3d924 authored by Yang Jihong's avatar Yang Jihong Committed by Namhyung Kim

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

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

Fixes: b52956c9 ("perf tools: Allow multiple threads or processes in record, stat, top")
Reviewed-by: default avatarArnaldo Carvalho de Melo <acme@redhat.com>
Signed-off-by: default avatarYang Jihong <yangjihong1@huawei.com>
Signed-off-by: default avatarNamhyung Kim <namhyung@kernel.org>
Link: https://lore.kernel.org/r/20240206083228.172607-6-yangjihong1@huawei.com
parent bd2cdf26
...@@ -280,13 +280,13 @@ struct perf_thread_map *thread_map__new_by_tid_str(const char *tid_str) ...@@ -280,13 +280,13 @@ struct perf_thread_map *thread_map__new_by_tid_str(const char *tid_str)
threads->nr = ntasks; threads->nr = ntasks;
} }
out: out:
strlist__delete(slist);
if (threads) if (threads)
refcount_set(&threads->refcnt, 1); refcount_set(&threads->refcnt, 1);
return threads; return threads;
out_free_threads: out_free_threads:
zfree(&threads); zfree(&threads);
strlist__delete(slist);
goto out; goto out;
} }
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment