]> err.no Git - yubikey-personalization/commitdiff
we need to CFRetain(yk) after opening the device
authorKlas Lindfors <klas@yubico.com>
Wed, 10 Oct 2012 06:44:41 +0000 (08:44 +0200)
committerKlas Lindfors <klas@yubico.com>
Wed, 10 Oct 2012 07:31:03 +0000 (09:31 +0200)
and do CFRelease() when closing the device

ykcore/ykcore_osx.c

index 55c4786145f5580283c9da6a1d79c2e48c058f9a..4802060fca8c946628d6445dc6d0495f0b7f2f9b 100644 (file)
@@ -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;