]> git.sesse.net Git - mlt/commitdiff
fix memory leak (coverity-709375)
authorDan Dennedy <dan@dennedy.org>
Sun, 22 Jul 2012 23:24:49 +0000 (16:24 -0700)
committerDan Dennedy <dan@dennedy.org>
Sun, 22 Jul 2012 23:24:49 +0000 (16:24 -0700)
src/framework/mlt_consumer.c
src/framework/mlt_consumer.h

index 9de633231da5f92169d220c7498712985305164e..e5fb1e1121e5560f3ed259d02f7f9e57aef9385c 100644 (file)
@@ -1000,6 +1000,7 @@ static void consumer_work_start( mlt_consumer self )
 
        // We're running now
        self->ahead = 1;
+       self->threads = thread;
        
        // These keep track of the accelleration of frame dropping or recovery.
        self->consecutive_dropped = 0;
@@ -1136,8 +1137,8 @@ static void consumer_work_stop( mlt_consumer self )
                        pthread_join( *thread, NULL );
 
                // Deallocate the array of threads
-               if ( thread )
-                       free( thread );
+               if ( self->threads )
+                       free( self->threads );
 
                // Indicate that worker threads no longer running
                self->started = 0;
index 741eb0d654db34bc944c3cdf7841bde898fc7376..b0b48e9cad354f4331c3ed882bc63ee1054f67d9 100644 (file)
@@ -129,6 +129,7 @@ struct mlt_consumer_s
        int consecutive_rendered;
        int process_head;
        int started;
+       pthread_t *threads; /**< \private used to deallocate all threads */
 };
 
 #define MLT_CONSUMER_SERVICE( consumer )       ( &( consumer )->parent )