perf stat: Fix affinity memory leaks on error path

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

[ Upstream commit 7f6ccb70e465bd8c9cf8973aee1c01224e4bdb3c ]

Missed cleanup when an error occurs.

Fixes: 49de179577 ("perf stat: No need to setup affinities when starting a workload")
Signed-off-by: Ian Rogers <irogers@google.com>
Link: https://lore.kernel.org/r/20241001052327.7052-2-irogers@google.com
Signed-off-by: Namhyung Kim <namhyung@kernel.org>
Signed-off-by: Sasha Levin <sashal@kernel.org>
Signed-off-by: Koichiro Den <koichiro.den@canonical.com>
Signed-off-by: Stefan Bader <stefan.bader@canonical.com>
This commit is contained in:
Ian Rogers
2025-03-11 08:51:19 +09:00
committed by Stefan Bader
parent 77a22d341b
commit 8b4e317df0
+2
View File
@@ -823,6 +823,7 @@ try_again_reset:
}
}
affinity__cleanup(affinity);
affinity = NULL;
evlist__for_each_entry(evsel_list, counter) {
if (!counter->supported) {
@@ -961,6 +962,7 @@ err_out:
if (forks)
evlist__cancel_workload(evsel_list);
affinity__cleanup(affinity);
return err;
}