]> git.sesse.net Git - mlt/commitdiff
mlt_consumer_start(): get mutex before accessing put_active
authorMikko Rapeli <mikko.rapeli@iki.fi>
Tue, 24 Jul 2012 17:44:53 +0000 (19:44 +0200)
committerMikko Rapeli <mikko.rapeli@iki.fi>
Tue, 24 Jul 2012 18:00:13 +0000 (20:00 +0200)
Fixes Coverity CID 709355: Data race condition (MISSING_LOCK)
Accessing variable "self->put_active" (mlt_consumer_s.put_active) requires the mlt_consumer_s.put_mutex lock.
 411        self->put_active = 1;

src/framework/mlt_consumer.c

index 08f990fb73a6f5ce05f85d178b21de5d0f20743c..5ce25328eab4ee5dbca382c3756e099ee6072c60 100644 (file)
@@ -414,8 +414,10 @@ int mlt_consumer_start( mlt_consumer self )
        char *test_card = mlt_properties_get( properties, "test_card" );
 
        // Just to make sure nothing is hanging around...
+       pthread_mutex_lock( &self->put_mutex );
        self->put = NULL;
        self->put_active = 1;
+       pthread_mutex_unlock( &self->put_mutex );
 
        // Deal with it now.
        if ( test_card != NULL )