Created
November 27, 2021 04:35
-
-
Save STRRL/09fd544c1281a8d0273a85e767f5b3ac to your computer and use it in GitHub Desktop.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
diff --git a/collector/thermal_darwin.go b/collector/thermal_darwin.go | |
index 282ca3f..fa96f1f 100644 | |
--- a/collector/thermal_darwin.go | |
+++ b/collector/thermal_darwin.go | |
@@ -118,7 +118,9 @@ func (c *thermCollector) Update(ch chan<- prometheus.Metric) error { | |
func fetchCPUPowerStatus() (map[string]int, error) { | |
cfDictRef, _ := C.FetchThermal() | |
defer func() { | |
- C.CFRelease(C.CFTypeRef(cfDictRef.ref)) | |
+ if C.kIOReturnSuccess == cfDictRef.ret { | |
+ C.CFRelease(C.CFTypeRef(cfDictRef.ref)) | |
+ } | |
}() | |
if C.kIOReturnNotFound == cfDictRef.ret { |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
PTAL @kmahyyg , THANKS A LOT.