OSDN Git Service

Fix several MB of memory leaks in lame, and vorbis.
authorsaintdev <saintdev@b64f7644-9d1e-0410-96f1-a4d463321fa5>
Sun, 1 Apr 2007 04:47:47 +0000 (04:47 +0000)
committersaintdev <saintdev@b64f7644-9d1e-0410-96f1-a4d463321fa5>
Sun, 1 Apr 2007 04:47:47 +0000 (04:47 +0000)
6ch Vorbis doesn't seem quite ready for prime time.

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

libhb/enclame.c
libhb/encvorbis.c
libhb/encxvid.c
libhb/muxogm.c
test/test.c

index c0b0f9d..33cfa14 100644 (file)
@@ -68,6 +68,13 @@ int enclameInit( hb_work_object_t * w, hb_job_t * job )
  **********************************************************************/
 void enclameClose( hb_work_object_t * w )
 {
+    hb_work_private_t * pv = w->private_data;
+    
+    lame_close( pv->lame );
+    hb_list_empty( &pv->list );
+    free( pv->buf );
+    free( pv );
+    w->private_data = NULL;
 }
 
 /***********************************************************************
index 01c71e8..169cb93 100644 (file)
@@ -120,6 +120,18 @@ int encvorbisInit( hb_work_object_t * w, hb_job_t * job )
  **********************************************************************/
 void encvorbisClose( hb_work_object_t * w )
 {
+    hb_work_private_t * pv = w->private_data;
+    
+    vorbis_block_clear( &pv->vb );
+    vorbis_dsp_clear( &pv->vd );
+    vorbis_comment_clear( &pv->vc );
+    vorbis_info_clear( &pv->vi );
+    
+    hb_list_empty( &pv->list );
+    
+    free( pv->buf );
+    free( pv );
+    w->private_data = NULL;
 }
 
 /***********************************************************************
index 7768f8e..6d869ae 100644 (file)
@@ -131,6 +131,9 @@ void encxvidClose( hb_work_object_t * w )
         hb_log( "encxvid: closing libxvidcore" );
         xvid_encore( pv->xvid, XVID_ENC_DESTROY, NULL, NULL);
     }
+    
+    free( pv );
+    w->private_data = NULL;
 }
 
 /***********************************************************************
index 6a3b1ec..656c8e7 100644 (file)
@@ -336,6 +336,8 @@ static int OGMEnd( hb_mux_object_t * m )
     {
         return -1;
     }
+    ogg_stream_clear( &mux_data->os );
+    
     for( i = 0; i < hb_list_count( title->list_audio ); i++ )
     {
         audio = hb_list_item( title->list_audio, i );
@@ -344,6 +346,7 @@ static int OGMEnd( hb_mux_object_t * m )
         {
             return -1;
         }
+        ogg_stream_clear( &mux_data->os );
     }
 
     fclose( m->file );
index 818ceea..30eeb4d 100644 (file)
@@ -980,9 +980,10 @@ static int CheckOptions( int argc, char ** argv )
             }\r
         }\r
                \r
-               if (acodec != HB_ACODEC_FAAC && acodec != HB_ACODEC_VORBIS)\r
+               if (acodec != HB_ACODEC_FAAC)\r
                {\r
-                       /* only attempt 5.1 export if exporting to AAC or Vorbis */\r
+                       /* only attempt 5.1 export if exporting to AAC or Vorbis */
+                       /* Vorbis doesn't seem to be quite ready yet */\r
                        surround = 0;\r
         }\r
                \r