summaryrefslogtreecommitdiff
path: root/tools
diff options
context:
space:
mode:
authorIan Rogers <irogers@google.com>2024-09-30 22:23:24 -0700
committerGreg Kroah-Hartman <gregkh@linuxfoundation.org>2024-12-09 10:32:24 +0100
commit380bc5a698b907fc4dd54ba7f58fe090f17e5c54 (patch)
treea6b6bcbaaba62c6f2de37e22f86e5d945f574774 /tools
parent035c6b7a13aca5b8c6ed604f40e8101a498ab8d2 (diff)
downloadlinux-380bc5a698b907fc4dd54ba7f58fe090f17e5c54.tar.gz
linux-380bc5a698b907fc4dd54ba7f58fe090f17e5c54.tar.bz2
linux-380bc5a698b907fc4dd54ba7f58fe090f17e5c54.zip
perf stat: Fix affinity memory leaks on error path
[ Upstream commit 7f6ccb70e465bd8c9cf8973aee1c01224e4bdb3c ] Missed cleanup when an error occurs. Fixes: 49de179577e7 ("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>
Diffstat (limited to 'tools')
-rw-r--r--tools/perf/builtin-stat.c2
1 files changed, 2 insertions, 0 deletions
diff --git a/tools/perf/builtin-stat.c b/tools/perf/builtin-stat.c
index 8bc526e1cb5f..9692ebdd7f11 100644
--- a/tools/perf/builtin-stat.c
+++ b/tools/perf/builtin-stat.c
@@ -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;
}