From 231c65d503369b02458709b9acacc84a864bbdc1 Mon Sep 17 00:00:00 2001 From: Klas Lindfors Date: Wed, 10 Oct 2012 08:44:41 +0200 Subject: [PATCH] we need to CFRetain(yk) after opening the device and do CFRelease() when closing the device --- ykcore/ykcore_osx.c | 2 ++ 1 file changed, 2 insertions(+) diff --git a/ykcore/ykcore_osx.c b/ykcore/ykcore_osx.c index 55c4786..4802060 100644 --- a/ykcore/ykcore_osx.c +++ b/ykcore/ykcore_osx.c @@ -100,6 +100,7 @@ void *_ykusb_open_device(int vendor_id, int product_id) if (cnt > 0) { yk = (void *) CFArrayGetValueAtIndex( array, 0 ); + CFRetain(yk); } else { rc = YK_ENOKEY; @@ -132,6 +133,7 @@ error: int _ykusb_close_device(void *dev) { _ykusb_IOReturn = IOHIDDeviceClose( dev, 0L ); + CFRelease(dev); if ( _ykusb_IOReturn == kIOReturnSuccess ) return 1; -- 2.39.5