[Theora-dev] [PATCH] naked mallocs

Conrad Parker conrad
Thu Jun 17 00:59:49 PDT 2004


I was offended to find that there were some naked mallocs in lib/toplevel.c
so the attached patch corrects this indecency.

Kfish.
-------------- next part --------------
Index: toplevel.c
===================================================================
--- toplevel.c	(revision 6620)
+++ toplevel.c	(working copy)
@@ -1125,10 +1125,10 @@
oggpack_buffer *opb;

#ifndef LIBOGG2
-  opb = malloc(sizeof(oggpack_buffer));
+  opb = _ogg_malloc(sizeof(oggpack_buffer));
oggpackB_writeinit(opb);
#else
-  opb = malloc(oggpack_buffersize());
+  opb = _ogg_malloc(oggpack_buffersize());
oggpackB_writeinit(opb, ogg_buffer_create());
#endif
oggpackB_write(opb, 0x81, 8);
@@ -1153,7 +1153,7 @@

#ifndef LIBOGG2
/* So we're expecting the application with free this? */
-  op->packet=malloc(oggpack_bytes(opb));
+  op->packet=_ogg_malloc(oggpack_bytes(opb));
memcpy(op->packet, oggpack_get_buffer(opb), oggpack_bytes(opb));
oggpack_writeclear(opb);
#else
@@ -1364,10 +1364,10 @@
if(!op)return OC_BADHEADER;

#ifndef LIBOGG2
-  opb = malloc(sizeof(oggpack_buffer));
+  opb = _ogg_malloc(sizeof(oggpack_buffer));
oggpackB_readinit(opb,op->packet,op->bytes);
#else
-  opb = malloc(oggpack_buffersize());
+  opb = _ogg_malloc(oggpack_buffersize());
oggpackB_readinit(opb,op->packet);
#endif
{


More information about the Theora-dev mailing list