]> git.sesse.net Git - mlt/commitdiff
sdl/consumer_sdl_preview.c: check for null pointer
authorMikko Rapeli <mikko.rapeli@iki.fi>
Wed, 1 Aug 2012 15:19:12 +0000 (17:19 +0200)
committerMikko Rapeli <mikko.rapeli@iki.fi>
Mon, 6 Aug 2012 16:37:28 +0000 (18:37 +0200)
Fixes Coverity CID 709403: Dereference before null check (REVERSE_INULL)
Dereferencing pointer "this->play". [show details]
290        int eos_threshold = 20 + mlt_properties_get_int( MLT_CONSUMER_PROPERTIES( this->play ), "buffer" );
...
Assigning: "this->active" = "this->play".
424                                        this->active = this->play;
...
Dereferencing "this->play" before a null check.
466        if ( this->play ) mlt_consumer_stop( this->play );

src/modules/sdl/consumer_sdl_preview.c

index 7a9b44fbd1045ee4ae1e8f384c6437683742ad36..8bdde6a373cd14aa3118fc5ef39c757e4bdd6baa 100644 (file)
@@ -287,7 +287,9 @@ static void *consumer_thread( void *arg )
        mlt_frame frame = NULL;
        int last_position = -1;
        int eos = 0;
-       int eos_threshold = 20 + mlt_properties_get_int( MLT_CONSUMER_PROPERTIES( this->play ), "buffer" );
+       int eos_threshold = 20;
+       if ( this->play )
+               eos_threshold = eos_threshold + mlt_properties_get_int( MLT_CONSUMER_PROPERTIES( this->play ), "buffer" );
 
        // Determine if the application is dealing with the preview
        int preview_off = mlt_properties_get_int( properties, "preview_off" );