[vlc-devel] [PATCH 1/2] video_filter/blendbench: Create: add missing error-check

Filip Roséen filip at atch.se
Wed Mar 22 04:40:07 CET 2017


As blendbench.c:Filter relies on the p_sys->p_blend_image to refer to
a valid picture_t, we need to make sure that the relevant call is
successful in blendbench.c:Create (as we otherwise would have a
null-pointer dereference further down the road).

refs: #18116
fixes: #18145
---
 modules/video_filter/blendbench.c | 13 +++++++++++--
 1 file changed, 11 insertions(+), 2 deletions(-)

diff --git a/modules/video_filter/blendbench.c b/modules/video_filter/blendbench.c
index 47bf8930f0..5f42436124 100644
--- a/modules/video_filter/blendbench.c
+++ b/modules/video_filter/blendbench.c
@@ -195,11 +195,20 @@ static int Create( vlc_object_t *p_this )
     p_sys->i_blend_chroma = VLC_FOURCC( psz_temp[0], psz_temp[1],
                                         psz_temp[2], psz_temp[3] );
     psz_cmd = var_CreateGetStringCommand( p_filter, CFG_PREFIX "blend-image" );
-    blendbench_LoadImage( p_this, &p_sys->p_blend_image, p_sys->i_blend_chroma,
-                          psz_cmd, "Blend" );
+    i_ret = blendbench_LoadImage( p_this, &p_sys->p_blend_image, p_sys->i_blend_chroma,
+                                  psz_cmd, "Blend" );
+
     free( psz_temp );
     free( psz_cmd );
 
+    if( i_ret != VLC_SUCCESS )
+    {
+        picture_Release( p_sys->p_base_image );
+        free( p_sys );
+
+        return VLC_EGENERIC;
+    }
+
     return VLC_SUCCESS;
 }
 
-- 
2.12.0


More information about the vlc-devel mailing list