don't crash on intel

This commit is contained in:
Jos Dehaes 2021-10-16 21:09:21 +02:00
parent 9f88187c29
commit c252c618c0

View file

@ -62,7 +62,7 @@ unordered_flat_map<int, double> Cpu::ThermalSensors::getSensors() {
IOHIDEventSystemClientRef system = IOHIDEventSystemClientCreate(kCFAllocatorDefault);
IOHIDEventSystemClientSetMatching(system, thermalSensors);
CFArrayRef matchingsrvs = IOHIDEventSystemClientCopyServices(system);
if (matchingsrvs) {
long count = CFArrayGetCount(matchingsrvs);
for (int i = 0; i < count; i++) {
IOHIDServiceClientRef sc = (IOHIDServiceClientRef)CFArrayGetValueAtIndex(matchingsrvs, i);
@ -84,6 +84,7 @@ unordered_flat_map<int, double> Cpu::ThermalSensors::getSensors() {
}
}
CFRelease(matchingsrvs);
}
CFRelease(system);
CFRelease(thermalSensors);
return cpuValues;