mirror of
git://git.kernel.org/pub/scm/linux/kernel/git/torvalds/linux.git
synced 2026-04-12 09:20:50 +08:00
perf test: Fix leak in "Synthesize attr update" test
The own_cpus map variable may be non-NULL and hold a reference, in particular on hybrid machines. Do a put before overwriting the variable to avoid a memory leak. Signed-off-by: Ian Rogers <irogers@google.com> Reviewed-by: James Clark <james.clark@linaro.org> Link: https://lore.kernel.org/r/20250305191931.604764-1-irogers@google.com Signed-off-by: Namhyung Kim <namhyung@kernel.org>
This commit is contained in:
@@ -109,6 +109,7 @@ static int test__event_update(struct test_suite *test __maybe_unused, int subtes
|
||||
TEST_ASSERT_VAL("failed to synthesize attr update name",
|
||||
!perf_event__synthesize_event_update_name(&tmp.tool, evsel, process_event_name));
|
||||
|
||||
perf_cpu_map__put(evsel->core.own_cpus);
|
||||
evsel->core.own_cpus = perf_cpu_map__new("1,2,3");
|
||||
|
||||
TEST_ASSERT_VAL("failed to synthesize attr update cpus",
|
||||
|
||||
Reference in New Issue
Block a user