diff options
| author | Namhyung Kim <namhyung@kernel.org> | 2026-07-13 16:45:35 -0700 |
|---|---|---|
| committer | Namhyung Kim <namhyung@kernel.org> | 2026-07-15 16:50:06 -0700 |
| commit | 60de2c6561ae57b5f2c50efecc1fa1f0081f731a (patch) | |
| tree | 374fdd625e9848c63f7e6f82c82b32dce81bf5eb | |
| parent | 2bd4ad6914ed73189ccc2fb2740e94dafd1a9a8f (diff) | |
| download | linux-60de2c6561ae57b5f2c50efecc1fa1f0081f731a.tar.gz linux-60de2c6561ae57b5f2c50efecc1fa1f0081f731a.zip | |
perf sched: Fix memory leaks in perf sched stats report
The second pass data is not saved in the list and only used to calculate
delta from the first pass. Let's free the data after use.
Fixes: 5a357ae6ad63 ("perf sched stats: Add support for report subcommand")
Reviewed-and-tested-by: Swapnil Sapkal <swapnil.sapkal@amd.com>
Signed-off-by: Namhyung Kim <namhyung@kernel.org>
| -rw-r--r-- | tools/perf/builtin-sched.c | 4 |
1 files changed, 4 insertions, 0 deletions
diff --git a/tools/perf/builtin-sched.c b/tools/perf/builtin-sched.c index c5728f3aa46f..ab9590c4d838 100644 --- a/tools/perf/builtin-sched.c +++ b/tools/perf/builtin-sched.c @@ -4631,6 +4631,8 @@ static int perf_sched__process_schedstat(const struct perf_tool *tool __maybe_un domain_second_pass = list_first_entry(&cpu_second_pass->domain_head, struct schedstat_domain, domain_list); store_schedstat_cpu_diff(temp); + free(temp->cpu_data); + free(temp); } } else if (event->header.type == PERF_RECORD_SCHEDSTAT_DOMAIN) { struct schedstat_cpu *cpu_tail; @@ -4651,6 +4653,8 @@ static int perf_sched__process_schedstat(const struct perf_tool *tool __maybe_un } else { store_schedstat_domain_diff(temp); domain_second_pass = list_next_entry(domain_second_pass, domain_list); + free(temp->domain_data); + free(temp); } } |
