[vlc-devel] [PATCH 2/2] cvpx: set p_sys only when success

Alexandre Janniaux ajanni at videolabs.io
Tue Jul 28 13:54:03 CEST 2020


Setting filter->p_sys unconditonnally could create failures in following
filters if the filter fails to open.
---
 modules/video_chroma/cvpx.c | 3 ++-
 1 file changed, 2 insertions(+), 1 deletion(-)

diff --git a/modules/video_chroma/cvpx.c b/modules/video_chroma/cvpx.c
index 147d064ff7..ccd0e5f490 100644
--- a/modules/video_chroma/cvpx.c
+++ b/modules/video_chroma/cvpx.c
@@ -447,7 +447,7 @@ Open_CVPX_to_CVPX(vlc_object_t *obj)
     CHECK_CHROMA(filter->fmt_out.video.i_chroma)
 #undef CHECK_CHROMA
 
-    filter_sys_t *p_sys  = filter->p_sys = calloc(1, sizeof(filter_sys_t));
+    filter_sys_t *p_sys  = calloc(1, sizeof(filter_sys_t));
     if (!p_sys)
         return VLC_ENOMEM;
 
@@ -466,6 +466,7 @@ Open_CVPX_to_CVPX(vlc_object_t *obj)
         return VLC_EGENERIC;
     }
 
+    filter->p_sys = p_sys;
     filter->pf_video_filter = Filter;
     filter->vctx_out = vlc_video_context_Hold(filter->vctx_in);
     filter->fmt_out.i_codec = filter->fmt_out.video.i_chroma;
-- 
2.27.0



More information about the vlc-devel mailing list