Skip to content

Commit

Permalink
perf test: Fix leak in "Synthesize attr update" test
Browse files Browse the repository at this point in the history
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>
  • Loading branch information
Ian Rogers authored and Namhyung Kim committed Mar 6, 2025
1 parent 4145310 commit 2c744f3
Showing 1 changed file with 1 addition and 0 deletions.
1 change: 1 addition & 0 deletions tools/perf/tests/event_update.c
Original file line number Diff line number Diff line change
Expand Up @@ -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",
Expand Down

0 comments on commit 2c744f3

Please sign in to comment.