[vlc-commits] filter: canvas: add some error handling

Tristan Matthews git at videolan.org
Wed Feb 3 23:52:02 CET 2016


vlc | branch: master | Tristan Matthews <tmatth at videolan.org> | Wed Feb  3 23:51:39 2016 +0100| [85fd0c6cfc0137202e28852982f8e5a49df22ebd] | committer: Tristan Matthews

filter: canvas: add some error handling

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

 modules/video_filter/canvas.c |   18 ++++++++++++++++--
 1 file changed, 16 insertions(+), 2 deletions(-)

diff --git a/modules/video_filter/canvas.c b/modules/video_filter/canvas.c
index 9160725..f4b7970 100644
--- a/modules/video_filter/canvas.c
+++ b/modules/video_filter/canvas.c
@@ -329,10 +329,24 @@ static int Activate( vlc_object_t *p_this )
 
     filter_chain_Reset( p_sys->p_chain, &p_filter->fmt_in, &fmt );
     /* Append scaling module */
-    filter_chain_AppendFilter( p_sys->p_chain, NULL, NULL, NULL, NULL );
+    if ( !filter_chain_AppendFilter( p_sys->p_chain, NULL, NULL, NULL, NULL ) )
+    {
+        msg_Err( p_filter, "Could not append scaling filter" );
+        free( p_sys );
+        return VLC_EGENERIC;
+    }
+
     /* Append croppadd module if we actually do cropping or padding instead of just scaling*/
     if( i_padd > 0 )
-        filter_chain_AppendFromString( p_sys->p_chain, psz_croppadd );
+    {
+        if ( !filter_chain_AppendFromString( p_sys->p_chain, psz_croppadd ) )
+        {
+            msg_Err( p_filter, "Could not append cropadd filter" );
+            filter_chain_Delete( p_sys->p_chain );
+            free( p_sys );
+            return VLC_EGENERIC;
+        }
+    }
 
     fmt = *filter_chain_GetFmtOut( p_sys->p_chain );
     es_format_Copy( &p_filter->fmt_out, &fmt );



More information about the vlc-commits mailing list