OSDN Git Service

fix buffer leak during indepth scan
authorjstebbins <jstebbins@b64f7644-9d1e-0410-96f1-a4d463321fa5>
Tue, 8 Dec 2009 23:48:54 +0000 (23:48 +0000)
committerjstebbins <jstebbins@b64f7644-9d1e-0410-96f1-a4d463321fa5>
Tue, 8 Dec 2009 23:48:54 +0000 (23:48 +0000)
and fix a couple potential leaks if the timing is just right in work loops

git-svn-id: svn://localhost/HandBrake/trunk@3016 b64f7644-9d1e-0410-96f1-a4d463321fa5

libhb/decvobsub.c
libhb/muxcommon.c
libhb/work.c

index c4474f9..1fd9d5b 100644 (file)
@@ -136,6 +136,10 @@ int decsubWork( hb_work_object_t * w, hb_buffer_t ** buf_in,
 
 void decsubClose( hb_work_object_t * w )
 {
+    hb_work_private_t * pv = w->private_data;
+
+    if ( pv->buf )
+        hb_buffer_close( &pv->buf );
     free( w->private_data );
 }
 
@@ -501,6 +505,7 @@ static hb_buffer_t * Decode( hb_work_object_t * w )
          * When forcing subtitles, ignore all those that don't
          * have the forced flag set.
          */
+        hb_buffer_close( &pv->buf );
         return NULL;
     }
 
index dbaa9c4..7ea3c79 100644 (file)
@@ -369,7 +369,13 @@ static void mux_loop( void * _w )
         if ( buf_in == NULL )
             continue;
         if ( *job->die )
+        {
+            if( buf_in )
+            {
+                hb_buffer_close( &buf_in );
+            }
             break;
+        }
 
         w->status = w->work( w, &buf_in, NULL );
     }
index ba4ea95..f4be983 100644 (file)
@@ -922,7 +922,13 @@ static void do_job( hb_job_t * job, int cpu_count )
         if ( buf_in == NULL )
             continue;
         if ( *job->die )
+        {
+            if( buf_in )
+            {
+                hb_buffer_close( &buf_in );
+            }
             break;
+        }
 
         w->status = w->work( w, &buf_in, &buf_out );
 
@@ -1120,7 +1126,13 @@ static void work_loop( void * _w )
         if ( buf_in == NULL )
             continue;
         if ( *w->done )
+        {
+            if( buf_in )
+            {
+                hb_buffer_close( &buf_in );
+            }
             break;
+        }
 
         w->status = w->work( w, &buf_in, &buf_out );