]> git.sesse.net Git - mlt/commitdiff
mlt_consumer.c: watch out for null pointer
authorMikko Rapeli <mikko.rapeli@iki.fi>
Tue, 24 Jul 2012 17:19:24 +0000 (19:19 +0200)
committerMikko Rapeli <mikko.rapeli@iki.fi>
Tue, 24 Jul 2012 17:19:24 +0000 (19:19 +0200)
Fixes Coverity CID 709393: Dereference before null check (REVERSE_INULL)
Directly dereferencing pointer "profile".
 235                profile->sample_aspect_num = mlt_properties_get_int( properties, "sample_aspect_num" );
Dereferencing "profile" before a null check.
 236                if ( profile )

src/framework/mlt_consumer.c

index 9ff244b72ac30072027730b67c23b4fc23b97590..de53a587696258836ae80ada68f3f475837eea36 100644 (file)
@@ -232,9 +232,11 @@ static void mlt_consumer_property_changed( mlt_properties owner, mlt_consumer se
        {
                mlt_properties properties = MLT_CONSUMER_PROPERTIES( self );
                mlt_profile profile = mlt_service_profile( MLT_CONSUMER_SERVICE( self ) );
-               profile->sample_aspect_num = mlt_properties_get_int( properties, "sample_aspect_num" );
                if ( profile )
+               {
+                       profile->sample_aspect_num = mlt_properties_get_int( properties, "sample_aspect_num" );
                        mlt_properties_set_double( properties, "aspect_ratio", mlt_profile_sar( profile )  );
+               }
        }
        else if ( !strcmp( name, "sample_aspect_den" ) )
        {