aboutsummaryrefslogtreecommitdiffstats
path: root/libavutil/mem.h
diff options
context:
space:
mode:
authorMichael Niedermayer <michael@niedermayer.cc>2015-11-18 14:19:47 +0100
committerMichael Niedermayer <michael@niedermayer.cc>2015-11-18 22:05:16 +0100
commitfc91eeab0b3c59f431653dec4e7358630b2c1f7e (patch)
treef801fb8a118f38c1d5d2c790f619e47d7945b0f9 /libavutil/mem.h
parent518742bc21f7baa4c9059e9705fca131d4e3a87a (diff)
downloadffmpeg-fc91eeab0b3c59f431653dec4e7358630b2c1f7e.tar.gz
avutil/mem: Add av_fast_mallocz()
Signed-off-by: Michael Niedermayer <michael@niedermayer.cc>
Diffstat (limited to 'libavutil/mem.h')
-rw-r--r--libavutil/mem.h15
1 files changed, 15 insertions, 0 deletions
diff --git a/libavutil/mem.h b/libavutil/mem.h
index a8eb14ee0f..d25b3229b7 100644
--- a/libavutil/mem.h
+++ b/libavutil/mem.h
@@ -385,6 +385,21 @@ void *av_fast_realloc(void *ptr, unsigned int *size, size_t min_size);
void av_fast_malloc(void *ptr, unsigned int *size, size_t min_size);
/**
+ * Allocate a buffer, reusing the given one if large enough.
+ *
+ * All newly allocated space is initially cleared
+ * Contrary to av_fast_realloc the current buffer contents might not be
+ * preserved and on error the old buffer is freed, thus no special
+ * handling to avoid memleaks is necessary.
+ *
+ * @param ptr pointer to pointer to already allocated buffer, overwritten with pointer to new buffer
+ * @param size size of the buffer *ptr points to
+ * @param min_size minimum size of *ptr buffer after returning, *ptr will be NULL and
+ * *size 0 if an error occurred.
+ */
+void av_fast_mallocz(void *ptr, unsigned int *size, size_t min_size);
+
+/**
* @}
*/