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

Tim Lammens git at videolan.org
Sat Jan 25 17:37:15 CET 2014


npapi-vlc | branch: master | Tim Lammens <tim.lammens at gmail.com> | Sat Jan 25 15:46:16 2014 +0100| [8cb00d38282968587f89c016ceca59fb582fc6cb] | committer: Felix Paul Kühne

macosx: fix memory leak in windowless plugin

Signed-off-by: Felix Paul Kühne <fkuehne at videolan.org>

> http://git.videolan.org/gitweb.cgi/npapi-vlc.git/?a=commit;h=8cb00d38282968587f89c016ceca59fb582fc6cb
---

 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);
 



More information about the vlc-commits mailing list