]> git.sesse.net Git - mlt/commitdiff
videostab/filter_videostab2.c: check for null
authorMikko Rapeli <mikko.rapeli@iki.fi>
Wed, 1 Aug 2012 16:04:03 +0000 (18:04 +0200)
committerMikko Rapeli <mikko.rapeli@iki.fi>
Mon, 6 Aug 2012 16:37:29 +0000 (18:37 +0200)
Fixes Coverity CID 709405: Dereference before null check (REVERSE_INULL)
Directly dereferencing pointer "data".
244        data->stab = calloc( 1, sizeof(StabData) );
245        data->trans = calloc( 1, sizeof (TransformData) ) ;
Dereferencing "data" before a null check.
246        if ( data )

src/modules/videostab/filter_videostab2.c

index 3d6df6dac2befb0cf9b6237dd4a9c31335e7a6d0..cd6e78faf3012376e67f654e9e8e2b9e5e9eae35 100644 (file)
@@ -241,10 +241,23 @@ static void filter_close( mlt_filter parent )
 mlt_filter filter_videostab2_init( mlt_profile profile, mlt_service_type type, const char *id, char *arg )
 {
        videostab2_data* data= calloc( 1, sizeof(videostab2_data));
-       data->stab = calloc( 1, sizeof(StabData) );
-       data->trans = calloc( 1, sizeof (TransformData) ) ;
        if ( data )
        {
+               data->stab = calloc( 1, sizeof(StabData) );
+               if ( !data->stab )
+               {
+                       free( data );
+                       return NULL;
+               }
+
+               data->trans = calloc( 1, sizeof (TransformData) ) ;
+               if ( !data->trans )
+               {
+                       free( data->stab );
+                       free( data );
+                       return NULL;
+               }
+
                mlt_filter parent = mlt_filter_new();
                if ( !parent )
                        return NULL;