Commit 70a20d48 authored by Felix Paul Kühne's avatar Felix Paul Kühne

macosx: fix longstanding ~30KB memory leak in the AppleRemote wrapper

parent efac86c9
...@@ -544,7 +544,7 @@ static void QueueCallbackFunction(void* target, IOReturn result, void* refcon, ...@@ -544,7 +544,7 @@ static void QueueCallbackFunction(void* target, IOReturn result, void* refcon,
long usage; long usage;
long usagePage; long usagePage;
id object; id object;
NSArray* elements = nil; NSArray* elements;
NSDictionary* element; NSDictionary* element;
IOReturn success; IOReturn success;
...@@ -557,8 +557,6 @@ static void QueueCallbackFunction(void* target, IOReturn result, void* refcon, ...@@ -557,8 +557,6 @@ static void QueueCallbackFunction(void* target, IOReturn result, void* refcon,
success = (*handle)->copyMatchingElements(handle, NULL, (CFArrayRef*)&elements); success = (*handle)->copyMatchingElements(handle, NULL, (CFArrayRef*)&elements);
if (success == kIOReturnSuccess) { if (success == kIOReturnSuccess) {
[elements autorelease];
/* /*
cookies = calloc(NUMBER_OF_APPLE_REMOTE_ACTIONS, sizeof(IOHIDElementCookie)); cookies = calloc(NUMBER_OF_APPLE_REMOTE_ACTIONS, sizeof(IOHIDElementCookie));
memset(cookies, 0, sizeof(IOHIDElementCookie) * NUMBER_OF_APPLE_REMOTE_ACTIONS); memset(cookies, 0, sizeof(IOHIDElementCookie) * NUMBER_OF_APPLE_REMOTE_ACTIONS);
...@@ -588,7 +586,10 @@ static void QueueCallbackFunction(void* target, IOReturn result, void* refcon, ...@@ -588,7 +586,10 @@ static void QueueCallbackFunction(void* target, IOReturn result, void* refcon,
} }
_allCookies = [[NSArray alloc] initWithArray: mutableAllCookies]; _allCookies = [[NSArray alloc] initWithArray: mutableAllCookies];
[mutableAllCookies release]; [mutableAllCookies release];
[elements release];
} else { } else {
if (elements)
[elements release];
return NO; return NO;
} }
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment