[vlc-commits] vout: ensure that the private_pool is always created

Thomas Guillem git at videolan.org
Wed Jan 11 13:04:54 CET 2017


vlc | branch: master | Thomas Guillem <thomas at gllm.fr> | Thu Jan  5 13:49:18 2017 +0100| [d5f845f702bdb70689eeed6c7f2e2ea4070f70fa] | committer: Thomas Guillem

vout: ensure that the private_pool is always created

Since the private_pool is used without null check.

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

 src/video_output/video_output.c |  2 +-
 src/video_output/vout_wrapper.c | 12 ++++++++++--
 2 files changed, 11 insertions(+), 3 deletions(-)

diff --git a/src/video_output/video_output.c b/src/video_output/video_output.c
index cde3808..6094faf 100644
--- a/src/video_output/video_output.c
+++ b/src/video_output/video_output.c
@@ -1423,7 +1423,7 @@ static int ThreadStart(vout_thread_t *vout, vout_display_state_t *state)
         vout_CloseWrapper(vout, state);
         goto error;
     }
-    assert(vout->p->decoder_pool);
+    assert(vout->p->decoder_pool && vout->p->private_pool);
 
     vout->p->displayed.current       = NULL;
     vout->p->displayed.next          = NULL;
diff --git a/src/video_output/vout_wrapper.c b/src/video_output/vout_wrapper.c
index 10c615e..310f50c 100644
--- a/src/video_output/vout_wrapper.c
+++ b/src/video_output/vout_wrapper.c
@@ -163,6 +163,13 @@ int vout_InitWrapper(vout_thread_t *vout)
         NoDrInit(vout);
     }
     sys->private_pool = picture_pool_Reserve(sys->decoder_pool, private_picture);
+    if (!sys->private_pool)
+    {
+        if (sys->decoder_pool != sys->display_pool)
+            picture_pool_Release(sys->decoder_pool);
+        sys->display_pool = sys->decoder_pool = NULL;
+        return VLC_EGENERIC;
+    }
     return VLC_SUCCESS;
 }
 
@@ -173,8 +180,9 @@ void vout_EndWrapper(vout_thread_t *vout)
 {
     vout_thread_sys_t *sys = vout->p;
 
-    if (sys->private_pool)
-        picture_pool_Release(sys->private_pool);
+    assert(vout->p->decoder_pool && vout->p->private_pool);
+
+    picture_pool_Release(sys->private_pool);
 
     if (sys->decoder_pool != sys->display_pool)
         picture_pool_Release(sys->decoder_pool);



More information about the vlc-commits mailing list