Skip to content

Commit 2313b97

Browse files
Emily Ehlertlenb
authored andcommitted
tools/power turbostat: Set per_cpu_msr_sum to NULL after free
Set per_cpu_msr_sum to NULL after freeing it in the error path of msr_sum_record() to prevent potential use-after-free issues. Signed-off-by: Emily Ehlert <ehemily@amazon.com> Signed-off-by: Len Brown <len.brown@intel.com>
1 parent 28a3ad1 commit 2313b97

1 file changed

Lines changed: 1 addition & 0 deletions

File tree

tools/power/x86/turbostat/turbostat.c

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -6652,6 +6652,7 @@ void msr_sum_record(void)
66526652
timer_delete(timerid);
66536653
release_msr:
66546654
free(per_cpu_msr_sum);
6655+
per_cpu_msr_sum = NULL;
66556656
}
66566657

66576658
/*

0 commit comments

Comments
 (0)