fix: fixed some memory leaks (#2306)

This commit is contained in:
andrewr
2025-01-06 02:23:19 +11:00
committed by GitHub
parent 1e27f32ccd
commit 713eb73787
2 changed files with 2 additions and 0 deletions

View File

@@ -652,6 +652,7 @@ public func getIOProperties(_ entry: io_registry_entry_t) -> NSDictionary? {
internal func getIOName(_ entry: io_registry_entry_t) -> String? {
let pointer = UnsafeMutablePointer<io_name_t>.allocate(capacity: 1)
defer { pointer.deallocate() }
let result = IORegistryEntryGetName(entry, pointer)
if result != kIOReturnSuccess {

View File

@@ -314,6 +314,7 @@ public class FrequencyReader: Reader<[Double]> {
self.channels = self.getChannels()
var dict: Unmanaged<CFMutableDictionary>?
self.subscription = IOReportCreateSubscription(nil, self.channels, &dict, 0, nil)
dict?.release()
}
public override func read() {