diff options
| author | Namhyung Kim <[email protected]> | 2025-07-03 01:49:36 +0000 |
|---|---|---|
| committer | Namhyung Kim <[email protected]> | 2025-07-03 18:28:29 +0000 |
| commit | aa9fdd106bab8c478d37eba5703c0950ad5c0d4f (patch) | |
| tree | 7607aef955781b67984483e91202030d745adf8c | |
| parent | perf sched: Make sure it frees the usage string (diff) | |
| download | kernel-aa9fdd106bab8c478d37eba5703c0950ad5c0d4f.tar.gz kernel-aa9fdd106bab8c478d37eba5703c0950ad5c0d4f.zip | |
perf sched: Free thread->priv using priv_destructor
In many perf sched subcommand saves priv data structure in the thread
but it forgot to free them. As it's an opaque type with 'void *', it
needs to register that knows how to free the data. In this case, just
regular 'free()' is fine.
Fixes: 04cb4fc4d40a5bf1 ("perf thread: Allow tools to register a thread->priv destructor")
Reviewed-by: Ian Rogers <[email protected]>
Tested-by: Ian Rogers <[email protected]>
Link: https://lore.kernel.org/r/[email protected]
Signed-off-by: Namhyung Kim <[email protected]>
| -rw-r--r-- | tools/perf/builtin-sched.c | 2 |
1 files changed, 2 insertions, 0 deletions
diff --git a/tools/perf/builtin-sched.c b/tools/perf/builtin-sched.c index b7bbfad0ed60..fa4052e04020 100644 --- a/tools/perf/builtin-sched.c +++ b/tools/perf/builtin-sched.c @@ -3898,6 +3898,8 @@ int cmd_sched(int argc, const char **argv) if (!argc) usage_with_options(sched_usage, sched_options); + thread__set_priv_destructor(free); + /* * Aliased to 'perf script' for now: */ |
