[vlc-devel] [PATCH 2/6] vout: ensure that the private_pool is always created
Thomas Guillem
thomas at gllm.fr
Thu Jan 5 14:37:40 CET 2017
Since the private_pool is used without null check.
---
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 2ed45045ec..84972dbfda 100644
--- a/src/video_output/video_output.c
+++ b/src/video_output/video_output.c
@@ -1424,7 +1424,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 10c615ea2a..310f50cdc6 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);
--
2.11.0
More information about the vlc-devel
mailing list