[vlc-commits] macosx: fix longstanding ~30KB memory leak in the AppleRemote wrapper
Felix Paul Kühne
git at videolan.org
Thu May 2 16:10:26 CEST 2013
vlc | branch: master | Felix Paul Kühne <fkuehne at videolan.org> | Thu May 2 15:10:04 2013 +0100| [70a20d4822cf8fec4a1c2fd6b2760fafcc20a36f] | committer: Felix Paul Kühne
macosx: fix longstanding ~30KB memory leak in the AppleRemote wrapper
> http://git.videolan.org/gitweb.cgi/vlc.git/?a=commit;h=70a20d4822cf8fec4a1c2fd6b2760fafcc20a36f
---
modules/gui/macosx/AppleRemote.m | 7 ++++---
1 file changed, 4 insertions(+), 3 deletions(-)
diff --git a/modules/gui/macosx/AppleRemote.m b/modules/gui/macosx/AppleRemote.m
index 1a8e113..b526a60 100644
--- a/modules/gui/macosx/AppleRemote.m
+++ b/modules/gui/macosx/AppleRemote.m
@@ -544,7 +544,7 @@ static void QueueCallbackFunction(void* target, IOReturn result, void* refcon,
long usage;
long usagePage;
id object;
- NSArray* elements = nil;
+ NSArray* elements;
NSDictionary* element;
IOReturn success;
@@ -557,8 +557,6 @@ static void QueueCallbackFunction(void* target, IOReturn result, void* refcon,
success = (*handle)->copyMatchingElements(handle, NULL, (CFArrayRef*)&elements);
if (success == kIOReturnSuccess) {
-
- [elements autorelease];
/*
cookies = calloc(NUMBER_OF_APPLE_REMOTE_ACTIONS, sizeof(IOHIDElementCookie));
memset(cookies, 0, sizeof(IOHIDElementCookie) * NUMBER_OF_APPLE_REMOTE_ACTIONS);
@@ -588,7 +586,10 @@ static void QueueCallbackFunction(void* target, IOReturn result, void* refcon,
}
_allCookies = [[NSArray alloc] initWithArray: mutableAllCookies];
[mutableAllCookies release];
+ [elements release];
} else {
+ if (elements)
+ [elements release];
return NO;
}
More information about the vlc-commits
mailing list