From d974650209c4ad9bae5d9609c85a9794e32259af Mon Sep 17 00:00:00 2001 From: soundflix <80773469+soundflix@users.noreply.github.com> Date: Sun, 5 Mar 2023 22:16:06 +0100 Subject: [PATCH] fixed missing pointer deallocation --- ZMAX/Sources/Extensions.swift | 6 ++++++ 1 file changed, 6 insertions(+) diff --git a/ZMAX/Sources/Extensions.swift b/ZMAX/Sources/Extensions.swift index 03cfb21..6051d7b 100644 --- a/ZMAX/Sources/Extensions.swift +++ b/ZMAX/Sources/Extensions.swift @@ -210,12 +210,18 @@ extension AXUIElement { extension AXValue { public func toValue() -> T? { let pointer = UnsafeMutablePointer.allocate(capacity: 1) + defer { + pointer.deallocate() + } let success = AXValueGetValue(self, AXValueGetType(self), pointer) return success ? pointer.pointee : nil } public static func from(value: T, type: AXValueType) -> AXValue? { let pointer = UnsafeMutablePointer.allocate(capacity: 1) + defer { + pointer.deallocate() + } pointer.pointee = value return AXValueCreate(type, pointer) }