From: Klas Lindfors Date: Wed, 10 Oct 2012 13:42:20 +0000 (+0200) Subject: workaround for a memory leak in IOHIDManagerCopyDevices() X-Git-Tag: v1.8.1~10 X-Git-Url: https://err.no/cgi-bin/gitweb.cgi?a=commitdiff_plain;h=dba1c3a6d59719b19177797383a14cb5148e48c8;p=yubikey-personalization workaround for a memory leak in IOHIDManagerCopyDevices() leaks 192 bytes/call on os x 10.8.2, by scheduling and unscheduling a run loop it doesn't leak. --- diff --git a/ykcore/ykcore_osx.c b/ykcore/ykcore_osx.c index cde0787..b3b6e63 100644 --- a/ykcore/ykcore_osx.c +++ b/ykcore/ykcore_osx.c @@ -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 ); }