mirror of
https://git.kernel.org/pub/scm/linux/kernel/git/torvalds/linux.git
synced 2026-08-30 13:23:02 -04:00
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: 5a357ae6ad ("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>
This commit is contained in:
@@ -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);
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
Reference in New Issue
Block a user