[xiph-commits] r3011 - liboggplay/trunk/src/liboggplay

tahn at svn.annodex.net tahn at svn.annodex.net
Wed Jun 20 18:51:10 PDT 2007


Author: tahn
Date: 2007-06-20 18:51:09 -0700 (Wed, 20 Jun 2007)
New Revision: 3011

Modified:
   liboggplay/trunk/src/liboggplay/oggplay_tcp_reader.c
Log:
All members of the oggplay tcp reader structure should be initialised in oggplay_tcp_reader_new to avoid uninitialised memory access.
Also removed a small memory leak.


Modified: liboggplay/trunk/src/liboggplay/oggplay_tcp_reader.c
===================================================================
--- liboggplay/trunk/src/liboggplay/oggplay_tcp_reader.c	2007-06-20 23:46:15 UTC (rev 3010)
+++ liboggplay/trunk/src/liboggplay/oggplay_tcp_reader.c	2007-06-21 01:51:09 UTC (rev 3011)
@@ -389,9 +389,6 @@
     me->state = OTRS_INIT_COMPLETE;
   }
 
-  me->backing_store = NULL;
-  me->mode = TCP_READER_FROM_MEMORY;
-    
   /*
    * Set the socket back to blocking mode.
    */
@@ -421,6 +418,7 @@
   }
 
   free(me->buffer);
+  free(me->location);
   if (me->backing_store != NULL) {
     fclose(me->backing_store);
   }
@@ -659,6 +657,10 @@
   me->buffer_size = 0;
   me->current_position = 0;
   me->location = strdup(location);
+  me->amount_in_memory = 0;
+  me->backing_store = NULL;
+  me->stored_offset = 0;
+  me->mode = TCP_READER_FROM_MEMORY;
 
   me->functions.initialise = &oggplay_tcp_reader_initialise;
   me->functions.destroy = &oggplay_tcp_reader_destroy;



More information about the commits mailing list