[vlc-commits] cvpx: set p_sys only when success

Alexandre Janniaux git at videolan.org
Tue Aug 18 15:09:25 CEST 2020


vlc | branch: master | Alexandre Janniaux <ajanni at videolabs.io> | Tue Jul 28 13:54:03 2020 +0200| [d668c878a23b0bcfad474ed3f8460676ffb8dbbe] | committer: Alexandre Janniaux

cvpx: set p_sys only when success

Setting filter->p_sys unconditonnally could create failures in following
filters if the filter fails to open.

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

 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 3e73e5bc44..d437313be9 100644
--- a/modules/video_chroma/cvpx.c
+++ b/modules/video_chroma/cvpx.c
@@ -458,7 +458,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;
 
@@ -477,6 +477,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;



More information about the vlc-commits mailing list