[vlc-devel] [PATCH] macosx: fix memory leak in windowless plugin

Tim Lammens tim.lammens at gmail.com
Sat Jan 25 15:46:16 CET 2014


---
 npapi/vlcwindowless_mac.cpp | 6 +++++-
 1 file changed, 5 insertions(+), 1 deletion(-)

diff --git a/npapi/vlcwindowless_mac.cpp b/npapi/vlcwindowless_mac.cpp
index 8c75aae..26da75a 100644
--- a/npapi/vlcwindowless_mac.cpp
+++ b/npapi/vlcwindowless_mac.cpp
@@ -207,6 +207,7 @@ bool VlcWindowlessMac::handle_event(void *event)
                                       kCGRenderingIntentPerceptual);
 
             CGDataProviderRelease(dataProvider);
+            CFRelease(dataRef);
 
             if (!lastFrame) {
                 fprintf(stderr, "image creation failed\n");
@@ -223,7 +224,10 @@ bool VlcWindowlessMac::handle_event(void *event)
             rect = CGRectMake(left, top, cached_width, cached_width);
         }
 
-        CGContextDrawImage(cgContext, rect, lastFrame);
+        if(lastFrame) {
+            CGContextDrawImage(cgContext, rect, lastFrame);
+            CGImageRelease(lastFrame);
+        }
 
         CGContextRestoreGState(cgContext);
 
-- 
1.8.3.4 (Apple Git-47)




More information about the vlc-devel mailing list