[vlc-commits] vout/ios: Fix leaks on initialization failure

Marvin Scholz git at videolan.org
Mon Jan 21 14:31:55 CET 2019


vlc | branch: master | Marvin Scholz <epirat07 at gmail.com> | Fri Jan 18 18:52:40 2019 +0100| [89f6b1902f261af32cc55465b3f45c3c856b68f5] | committer: Thomas Guillem

vout/ios: Fix leaks on initialization failure

Failing to initialize would not release the allocated self instance,
causing it to leak. Instead of the super dealloc just call release
on ourselves, this simplifies error handling too as dealloc takes
care of destroying the mutex and condition variables.

Signed-off-by: Thomas Guillem <thomas at gllm.fr>

> http://git.videolan.org/gitweb.cgi/vlc.git/?a=commit;h=89f6b1902f261af32cc55465b3f45c3c856b68f5
---

 modules/video_output/ios.m | 8 ++------
 1 file changed, 2 insertions(+), 6 deletions(-)

diff --git a/modules/video_output/ios.m b/modules/video_output/ios.m
index 51a9170fb8..7c072f6c78 100644
--- a/modules/video_output/ios.m
+++ b/modules/video_output/ios.m
@@ -403,9 +403,7 @@ static void GLESSwap(vlc_gl_t *gl)
      || unlikely(![EAGLContext setCurrentContext:_eaglContext]))
     {
         [_eaglContext release];
-        vlc_mutex_destroy(&_mutex);
-        vlc_cond_destroy(&_gl_attached_wait);
-        [super dealloc];
+        [self release];
         return nil;
     }
     [self releaseCurrent:previousEaglContext];
@@ -421,10 +419,8 @@ static void GLESSwap(vlc_gl_t *gl)
 
     if (![self fetchViewContainer])
     {
-        vlc_mutex_destroy(&_mutex);
-        vlc_cond_destroy(&_gl_attached_wait);
         [_eaglContext release];
-        [super dealloc];
+        [self release];
         return nil;
     }
 



More information about the vlc-commits mailing list