[vlc-devel] [PATCH] video context: don't create video contexts with no type

Steve Lhomme robux4 at ycbcr.xyz
Mon Nov 4 13:20:33 CET 2019


We keep VLC_VIDEO_CONTEXT_NONE to 0 to make sure some context are not created
accidentally with a type value of 0.
---
 src/input/decoder_helpers.c | 1 +
 1 file changed, 1 insertion(+)

diff --git a/src/input/decoder_helpers.c b/src/input/decoder_helpers.c
index 3d8a06985db..3f1eb9ff1d6 100644
--- a/src/input/decoder_helpers.c
+++ b/src/input/decoder_helpers.c
@@ -243,6 +243,7 @@ vlc_video_context * vlc_video_context_Create(vlc_decoder_device *device,
                                           size_t private_size,
                                           const struct vlc_video_context_operations *ops)
 {
+    assert(private_type != VLC_VIDEO_CONTEXT_NONE); // use a NULL video context for that
     vlc_video_context *vctx = malloc(sizeof(*vctx) + private_size);
     if (unlikely(vctx == NULL))
         return NULL;
-- 
2.17.1



More information about the vlc-devel mailing list