[MPlayer-cvslog] r29734 - trunk/libmpdemux/demux_mkv.c

reimar subversion at mplayerhq.hu
Wed Sep 30 09:33:05 CEST 2009


Author: reimar
Date: Wed Sep 30 09:33:05 2009
New Revision: 29734

Log:
Avoid a memleak if realloc fails in grow_array.

Modified:
   trunk/libmpdemux/demux_mkv.c

Modified: trunk/libmpdemux/demux_mkv.c
==============================================================================
--- trunk/libmpdemux/demux_mkv.c	Wed Sep 30 09:27:43 2009	(r29733)
+++ trunk/libmpdemux/demux_mkv.c	Wed Sep 30 09:33:05 2009	(r29734)
@@ -210,8 +210,11 @@ extern int dvdsub_id;
  */
 static void grow_array(void *arrayp, int nelem, size_t elsize) {
   void **array = arrayp;
+  void *oldp = *array;
   if (!(nelem & 31))
     *array = realloc(*array, (nelem + 32) * elsize);
+  if (!*array)
+    free(oldp);
 }
 
 static mkv_track_t *


More information about the MPlayer-cvslog mailing list