From: Klas Lindfors Date: Wed, 10 Oct 2012 06:44:41 +0000 (+0200) Subject: we need to CFRetain(yk) after opening the device X-Git-Tag: v1.8.1~12 X-Git-Url: https://err.no/cgi-bin/gitweb.cgi?a=commitdiff_plain;h=231c65d503369b02458709b9acacc84a864bbdc1;p=yubikey-personalization we need to CFRetain(yk) after opening the device and do CFRelease() when closing the device --- 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;