summaryrefslogtreecommitdiff
path: root/libavcodec/utils.c
diff options
context:
space:
mode:
authorBurkhard Plaum <plaum@ipf.uni-stuttgart.de>2004-11-27 18:10:06 +0000
committerMichael Niedermayer <michaelni@gmx.at>2004-11-27 18:10:06 +0000
commit073c2593c9f0aa4445a6fc1b9b24e6e52a8cc2c1 (patch)
treec7a83b25f8d183bce584cc6ed66c57f8505ea7ec /libavcodec/utils.c
parent8a6cb11455fcc89f506a44babdce1e021f6c592c (diff)
Memory leak fix patch by (Burkhard Plaum <plaum >at< ipf.uni-stuttgart )dot( de>)
Originally committed as revision 3717 to svn://svn.ffmpeg.org/ffmpeg/trunk
Diffstat (limited to 'libavcodec/utils.c')
-rw-r--r--libavcodec/utils.c20
1 files changed, 20 insertions, 0 deletions
diff --git a/libavcodec/utils.c b/libavcodec/utils.c
index c1f88d0cb4..d87ed6e139 100644
--- a/libavcodec/utils.c
+++ b/libavcodec/utils.c
@@ -90,6 +90,26 @@ void *av_mallocz_static(unsigned int size)
}
/**
+ * 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)