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

Marvin Scholz git at videolan.org
Wed Jan 23 19:56:56 CET 2019


vlc/vlc-3.0 | branch: master | Marvin Scholz <epirat07 at gmail.com> | Fri Jan 18 18:52:40 2019 +0100| [c52b8543b3c2353830992d5a5a7db20fdd1dd09c] | committer: Felix Paul Kühne

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>
(cherry picked from commit 89f6b1902f261af32cc55465b3f45c3c856b68f5)

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

 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 7452231d8d..2d14cc0880 100644
--- a/modules/video_output/ios.m
+++ b/modules/video_output/ios.m
@@ -419,9 +419,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];
@@ -437,10 +435,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