[theora-dev] Patch for memory leak in toplevel.c

Mauricio Piacentini mauricio at tabuleiro.com
Fri Oct 25 07:31:35 PDT 2002


The toplevel.c file in the theora library is leaking memory. It is a small
leak during a compression run (fixed 10K), but a big leak during playback
(140K playing the test file submitted by Dan, more with longer files since
the huffman set is not being cleared) Attached is a patch to solve these.
This patch includes the previous one I submitted (only missing headers).
Please let me know if you need additional info on these patches, or if you
need them in another format or directly commited to CVS.

Regards,
Mauricio Piacentini
Tabuleiro

-------------- next part --------------
Index: toplevel.c
===================================================================
RCS file: /usr/local/cvsroot/theora/lib/toplevel.c,v
retrieving revision 1.12
diff -u -r1.12 toplevel.c
--- toplevel.c	25 Sep 2002 02:38:10 -0000	1.12
+++ toplevel.c	25 Oct 2002 14:15:49 -0000
@@ -16,6 +16,8 @@
  ********************************************************************/
 
 #include <stdlib.h>
+#include <string.h>
+#include <math.h>
 #include <ogg/ogg.h>
 #include <theora/theora.h>
 #include "encoder_internal.h"
@@ -1063,14 +1065,19 @@
       EClearFrameInfo(cpi);		
       ClearTmpBuffers(&cpi->pb);
       ClearPPInstance(&cpi->pp);
+
+	  _ogg_free(t->internal_encode);
       
     }
 
     if(pbi){
-
+      
+      ClearHuffmanSet(pbi);
       ClearFragmentInfo(pbi);
       ClearFrameInfo(pbi);
       ClearPBInstance(pbi);
+
+	  _ogg_free(t->internal_decode);
 
     }
 



More information about the Theora-dev mailing list