summaryrefslogtreecommitdiff
path: root/tools/perf/builtin-stat.c
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-05 14:02:19 +0100
commit17f36fc1bd9835b81e2a985dc25330fef5655106 (patch)
tree7987ca88437b501b8e78a20e043f770c68ded3e4 /tools/perf/builtin-stat.c
parent39c38ff97c7d86704758d1d1d1fdbf41f1a4ac88 (diff)
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/perf/builtin-stat.c')
-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 2c46bdbd9914..4933efdfee76 100644
--- a/tools/perf/builtin-stat.c
+++ b/tools/perf/builtin-stat.c
@@ -827,6 +827,7 @@ try_again_reset:
}
}
affinity__cleanup(affinity);
+ affinity = NULL;
evlist__for_each_entry(evsel_list, counter) {
if (!counter->supported) {
@@ -965,6 +966,7 @@ err_out:
if (forks)
evlist__cancel_workload(evsel_list);
+ affinity__cleanup(affinity);
return err;
}