perf sched: Fix memory leaks for evsel->priv in timehist
authorNamhyung Kim <namhyung@kernel.org>
Thu, 3 Jul 2025 01:49:39 +0000 (18:49 -0700)
committerNamhyung Kim <namhyung@kernel.org>
Thu, 3 Jul 2025 18:39:56 +0000 (11:39 -0700)
commit117e5c33b1c44037af016d77ce6c0b086d55535f
treeaa73164d3abfd100c58a6477122aa609fb25df08
parente2eb59260c4f6bac403491d0112891766b8650d1
perf sched: Fix memory leaks for evsel->priv in timehist

It uses evsel->priv to save per-cpu timing information.  It should be
freed when the evsel is released.

Add the priv destructor for evsel same as thread to handle that.

Fixes: 49394a2a24c78ce0 ("perf sched timehist: Introduce timehist command")
Reviewed-by: Ian Rogers <irogers@google.com>
Tested-by: Ian Rogers <irogers@google.com>
Link: https://lore.kernel.org/r/20250703014942.1369397-6-namhyung@kernel.org
Signed-off-by: Namhyung Kim <namhyung@kernel.org>
tools/perf/builtin-sched.c
tools/perf/util/evsel.c
tools/perf/util/evsel.h