Skip to content

Commit 2c744f3

Browse files
captain5050namhyung
authored andcommitted
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 <[email protected]> Reviewed-by: James Clark <[email protected]> Link: https://lore.kernel.org/r/[email protected] Signed-off-by: Namhyung Kim <[email protected]>
1 parent 4145310 commit 2c744f3

File tree

1 file changed

+1
-0
lines changed

1 file changed

+1
-0
lines changed

tools/perf/tests/event_update.c

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -109,6 +109,7 @@ static int test__event_update(struct test_suite *test __maybe_unused, int subtes
109109
TEST_ASSERT_VAL("failed to synthesize attr update name",
110110
!perf_event__synthesize_event_update_name(&tmp.tool, evsel, process_event_name));
111111

112+
perf_cpu_map__put(evsel->core.own_cpus);
112113
evsel->core.own_cpus = perf_cpu_map__new("1,2,3");
113114

114115
TEST_ASSERT_VAL("failed to synthesize attr update cpus",

0 commit comments

Comments
 (0)