[xiph-commits] r11794 - trunk/theora/examples

tterribe at svn.xiph.org tterribe at svn.xiph.org
Fri Aug 18 14:56:11 PDT 2006


Author: tterribe
Date: 2006-08-18 14:56:09 -0700 (Fri, 18 Aug 2006)
New Revision: 11794

Modified:
   trunk/theora/examples/encoder_example.c
Log:
Fix memory leak after calling theora_encode_comment().
Thanks to Jeremy Moles for the report.


Modified: trunk/theora/examples/encoder_example.c
===================================================================
--- trunk/theora/examples/encoder_example.c	2006-08-18 18:59:56 UTC (rev 11793)
+++ trunk/theora/examples/encoder_example.c	2006-08-18 21:56:09 UTC (rev 11794)
@@ -748,6 +748,12 @@
   theora_comment_init(&tc);
   theora_encode_comment(&tc,&op);
   ogg_stream_packetin(&to,&op);
+  /*theora_encode_comment() doesn't take a theora_state parameter, so it has to
+     allocate its own buffer to pass back the packet data.
+    If we don't free it here, we'll leak.
+    libogg2 makes this much cleaner: the stream owns the buffer after you call
+     packetin in libogg2, but this is not true in libogg1.*/
+  free(op.packet);
   theora_encode_tables(&td,&op);
   ogg_stream_packetin(&to,&op);
 



More information about the commits mailing list