Skip to content

Commit

Permalink
perf test event_update: Fix memory leak of evlist
Browse files Browse the repository at this point in the history
ASan reports a memory leak when running:

  # perf test "49: Synthesize attr update"

Caused by evlist not being deleted.

This patch adds the missing evlist__delete and removes the
perf_cpu_map__put since it's already being deleted by evlist__delete.

Signed-off-by: Riccardo Mancini <[email protected]>
Fixes: a6e5281 ("perf tools: Add event_update event unit type")
Cc: Ian Rogers <[email protected]>
Cc: Jiri Olsa <[email protected]>
Cc: Mark Rutland <[email protected]>
Cc: Namhyung Kim <[email protected]>
Cc: Peter Zijlstra <[email protected]>
Link: http://lore.kernel.org/lkml/f7994ad63d248f7645f901132d208fadf9f2b7e4.1626343282.git.rickyman7@gmail.com
Signed-off-by: Arnaldo Carvalho de Melo <[email protected]>
  • Loading branch information
Manciukic authored and acmel committed Jul 15, 2021
1 parent 233f2dc commit fc56f54
Showing 1 changed file with 1 addition and 1 deletion.
2 changes: 1 addition & 1 deletion tools/perf/tests/event_update.c
Original file line number Diff line number Diff line change
Expand Up @@ -118,6 +118,6 @@ int test__event_update(struct test *test __maybe_unused, int subtest __maybe_unu
TEST_ASSERT_VAL("failed to synthesize attr update cpus",
!perf_event__synthesize_event_update_cpus(&tmp.tool, evsel, process_event_cpus));

perf_cpu_map__put(evsel->core.own_cpus);
evlist__delete(evlist);
return 0;
}

0 comments on commit fc56f54

Please sign in to comment.