Prevent possible NULL pointer deference

Raised by cppcheck
This commit is contained in:
Alan Barr 2018-10-13 19:10:12 +01:00 committed by Hisham Muhammad
parent 79c939eb84
commit 60e557868a
1 changed files with 1 additions and 2 deletions

View File

@ -84,10 +84,9 @@ void ProcessList_freeCPULoadInfo(processor_cpu_load_info_t *p) {
if(0 != munmap(*p, vm_page_size)) { if(0 != munmap(*p, vm_page_size)) {
CRT_fatalError("Unable to free old CPU load information\n"); CRT_fatalError("Unable to free old CPU load information\n");
} }
}
*p = NULL; *p = NULL;
} }
}
unsigned ProcessList_allocateCPULoadInfo(processor_cpu_load_info_t *p) { unsigned ProcessList_allocateCPULoadInfo(processor_cpu_load_info_t *p) {
mach_msg_type_number_t info_size = sizeof(processor_cpu_load_info_t); mach_msg_type_number_t info_size = sizeof(processor_cpu_load_info_t);