]> err.no Git - yubikey-personalization/commitdiff
workaround for a memory leak in IOHIDManagerCopyDevices()
authorKlas Lindfors <klas@yubico.com>
Wed, 10 Oct 2012 13:42:20 +0000 (15:42 +0200)
committerKlas Lindfors <klas@yubico.com>
Wed, 10 Oct 2012 13:42:20 +0000 (15:42 +0200)
leaks 192 bytes/call on os x 10.8.2, by scheduling and unscheduling a run loop it doesn't leak.

ykcore/ykcore_osx.c

index cde0787e5209f0c7c708d36437adbbefa802957b..b3b6e63f63a9cc0cbf28f3fdf2a64e959f60dde6 100644 (file)
@@ -106,6 +106,10 @@ void *_ykusb_open_device(int vendor_id, int product_id)
                        rc = YK_ENOKEY;
                }
 
+               /* this is a workaround for a memory leak in IOHIDManagerCopyDevices() in 10.8 */
+               IOHIDManagerScheduleWithRunLoop( ykosxManager, CFRunLoopGetCurrent( ), kCFRunLoopDefaultMode );
+               IOHIDManagerUnscheduleFromRunLoop( ykosxManager, CFRunLoopGetCurrent( ), kCFRunLoopDefaultMode );
+
                CFRelease( array );
                CFRelease( devSet );
        }