perf synthetic-events: Fix uninitialized pthread_join

In perf_event__synthesize_threads(), fix an uninitialized pthread_join()
call when thread creation fails by only joining the successfully
created threads.

Assisted-by: Antigravity:gemini-3.1-pro
Fixes: 340b47f510 ("perf top: Implement multithreading for perf_event__synthesize_threads")
Signed-off-by: Ian Rogers <irogers@google.com>
Signed-off-by: Namhyung Kim <namhyung@kernel.org>
This commit is contained in:
Ian Rogers 2026-08-09 00:14:44 -07:00 committed by Namhyung Kim
parent 38d778acbe
commit 54ba44db4d

View File

@ -1221,8 +1221,8 @@ int perf_event__synthesize_threads(const struct perf_tool *tool,
}
err = 0;
out_join:
for (i = 0; i < thread_nr; i++)
pthread_join(synthesize_threads[i], NULL);
for (j = 0; j < i; j++)
pthread_join(synthesize_threads[j], NULL);
free(args);
free_threads:
free(synthesize_threads);