]> git.sesse.net Git - ffmpeg/blobdiff - libavutil/mem.h
Merge commit '4d05e9392f84702e3c833efa86e84c7f1cf5f612'
[ffmpeg] / libavutil / mem.h
index a8eb14ee0f69bb5b2c7f145ebbaf0cd855dc02c0..d25b3229b7ccbf0bfb0e3668f785cb1b5b860a3e 100644 (file)
@@ -384,6 +384,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);
+
 /**
  * @}
  */