diff utils.c @ 2370:26560d4fdb1f libavcodec

Memory leak fix patch by (Burkhard Plaum <plaum >at< ipf.uni-stuttgart )dot( de>)
author michael
date Sat, 27 Nov 2004 18:10:06 +0000
parents 7a6ff8cc7c95
children 582e635cfa08
line wrap: on
line diff
--- a/utils.c	Sat Nov 27 03:54:18 2004 +0000
+++ b/utils.c	Sat Nov 27 18:10:06 2004 +0000
@@ -90,6 +90,26 @@
 }
 
 /**
+ * same as above, but does realloc
+ */
+
+void *av_realloc_static(void *ptr, unsigned int size)
+{
+    int i;
+    if(!ptr)
+      return av_mallocz_static(size);
+    /* Look for the old ptr */
+    for(i = 0; i < last_static; i++) {
+        if(array_static[i] == ptr) {
+            array_static[i] = av_realloc(array_static[i], size);
+            return array_static[i];
+        }
+    }
+    return NULL;
+
+}
+
+/**
  * free all static arrays and reset pointers to 0.
  */
 void av_free_static(void)