[vlc-commits] Allow blendbench to bail out gracefully instead of crash when base image cannot be found

Cheng Sun git at videolan.org
Thu Dec 22 22:59:15 CET 2011


vlc | branch: master | Cheng Sun <chengsun9 at gmail.com> | Wed Dec 21 22:23:55 2011 +0000| [d4a0e2e215ac8b256d9ae454cac4353aadaf9ad6] | committer: Jean-Baptiste Kempf

Allow blendbench to bail out gracefully instead of crash when base image cannot be found

Signed-off-by: Jean-Baptiste Kempf <jb at videolan.org>

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

 modules/video_filter/blendbench.c |   10 ++++++++--
 1 files changed, 8 insertions(+), 2 deletions(-)

diff --git a/modules/video_filter/blendbench.c b/modules/video_filter/blendbench.c
index 239751d..40b935a 100644
--- a/modules/video_filter/blendbench.c
+++ b/modules/video_filter/blendbench.c
@@ -153,6 +153,7 @@ static int Create( vlc_object_t *p_this )
     filter_t *p_filter = (filter_t *)p_this;
     filter_sys_t *p_sys;
     char *psz_temp, *psz_cmd;
+    int i_ret;
 
     /* Allocate structure */
     p_filter->p_sys = malloc( sizeof( filter_sys_t ) );
@@ -178,10 +179,15 @@ static int Create( vlc_object_t *p_this )
     p_sys->i_base_chroma = VLC_FOURCC( psz_temp[0], psz_temp[1],
                                        psz_temp[2], psz_temp[3] );
     psz_cmd = var_CreateGetStringCommand( p_filter, CFG_PREFIX "base-image" );
-    blendbench_LoadImage( p_this, &p_sys->p_base_image, p_sys->i_base_chroma,
-                          psz_cmd, "Base" );
+    i_ret = blendbench_LoadImage( p_this, &p_sys->p_base_image,
+                                  p_sys->i_base_chroma, psz_cmd, "Base" );
     free( psz_temp );
     free( psz_cmd );
+    if( i_ret != VLC_SUCCESS )
+    {
+        free( p_sys );
+        return i_ret;
+    }
 
     psz_temp = var_CreateGetStringCommand( p_filter,
                                            CFG_PREFIX "blend-chroma" );



More information about the vlc-commits mailing list