[vlc-devel] [PATCH 4/4] vout/ios: Fix leaks on initialization failure

Marvin Scholz epirat07 at gmail.com
Fri Jan 18 18:52:40 CET 2019


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.
---
 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 51a9170fb8d..7c072f6c786 100644
--- a/modules/video_output/ios.m
+++ b/modules/video_output/ios.m
@@ -403,9 +403,7 @@ - (id)initWithFrame:(CGRect)frame andVD:(vout_display_t*)vd
      || 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 @@ - (id)initWithFrame:(CGRect)frame andVD:(vout_display_t*)vd
 
     if (![self fetchViewContainer])
     {
-        vlc_mutex_destroy(&_mutex);
-        vlc_cond_destroy(&_gl_attached_wait);
         [_eaglContext release];
-        [super dealloc];
+        [self release];
         return nil;
     }
 
-- 
2.17.2 (Apple Git-113)



More information about the vlc-devel mailing list