[vlc-commits] vout: fix leaks in ThreadStart()

Rémi Denis-Courmont git at videolan.org
Sat Apr 25 09:24:48 CEST 2015


vlc | branch: master | Rémi Denis-Courmont <remi at remlab.net> | Sat Apr 25 10:22:27 2015 +0300| [547315ab6265a2a6547ddd8245d0b5a6265be97d] | committer: Rémi Denis-Courmont

vout: fix leaks in ThreadStart()

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

 src/video_output/video_output.c |   21 +++++++++++++++++----
 1 file changed, 17 insertions(+), 4 deletions(-)

diff --git a/src/video_output/video_output.c b/src/video_output/video_output.c
index b7af9d4..0ff1274 100644
--- a/src/video_output/video_output.c
+++ b/src/video_output/video_output.c
@@ -1324,9 +1324,9 @@ static int ThreadStart(vout_thread_t *vout, const vout_display_state_t *state)
     }
 
     if (vout_OpenWrapper(vout, vout->p->splitter_name, state))
-        return VLC_EGENERIC;
+        goto error;
     if (vout_InitWrapper(vout))
-        return VLC_EGENERIC;
+        goto error;
     assert(vout->p->decoder_pool);
 
     vout->p->displayed.current       = NULL;
@@ -1344,6 +1344,15 @@ static int ThreadStart(vout_thread_t *vout, const vout_display_state_t *state)
 
     video_format_Print(VLC_OBJECT(vout), "original format", &vout->p->original);
     return VLC_SUCCESS;
+error:
+    if (vout->p->filter.chain_interactive != NULL)
+        filter_chain_Delete(vout->p->filter.chain_interactive);
+    if (vout->p->filter.chain_static != NULL)
+        filter_chain_Delete(vout->p->filter.chain_static);
+    video_format_Clean(&vout->p->filter.format);
+    if (vout->p->decoder_fifo != NULL)
+        picture_fifo_Delete(vout->p->decoder_fifo);
+    return VLC_EGENERIC;
 }
 
 static void ThreadStop(vout_thread_t *vout, vout_display_state_t *state)
@@ -1444,8 +1453,12 @@ static int ThreadControl(vout_thread_t *vout, vout_control_cmd_t cmd)
     switch(cmd.type) {
     case VOUT_CONTROL_INIT:
         ThreadInit(vout);
-        if (!ThreadStart(vout, NULL))
-            break;
+        if (ThreadStart(vout, NULL))
+        {
+            ThreadClean(vout);
+            return 1;
+        }
+        break;
     case VOUT_CONTROL_CLEAN:
         ThreadStop(vout, NULL);
         ThreadClean(vout);



More information about the vlc-commits mailing list