fix CFRelease NULL crash on M5 Pro/Max (#29) PR #27 added NULL checks in getFrequency() to handle missing IOKit voltage-states properties on M5 chips (which lack E-cores). However, the CFRelease calls added in PR #26 were not similarly guarded. CFRelease(NULL) is undefined behavior per Apple docs and crashes the process. This adds NULL guards to the CFRelease calls so they are skipped when the IOKit properties don't exist. Fixes the remaining segfault from #25 that v0.2.0 did not resolve.
diff --git a/cpu.go b/cpu.go index 2ff008a..971bee7 100644 --- a/cpu.go +++ b/cpu.go
@@ -92,8 +92,8 @@ // // global_pCoreClock = pCoreClock; // global_eCoreClock = eCoreClock; -// CFRelease(pCoreRef); -// CFRelease(eCoreRef); +// if (pCoreRef) CFRelease(pCoreRef); +// if (eCoreRef) CFRelease(eCoreRef); // break; // } // }