aboutsummaryrefslogtreecommitdiffstats
path: root/libavcodec/avcodec.h
diff options
context:
space:
mode:
authorReimar Döffinger <Reimar.Doeffinger@gmx.de>2009-04-12 13:17:37 +0000
committerReimar Döffinger <Reimar.Doeffinger@gmx.de>2009-04-12 13:17:37 +0000
commit238ef6dadd13b9a867eaa7382bdba751e25c40b9 (patch)
treeac0228289581351403ee3f1d9ad187919d498fbb /libavcodec/avcodec.h
parent9bf993a5b5f8bf10c590d83c795467606f92cf6e (diff)
downloadffmpeg-238ef6dadd13b9a867eaa7382bdba751e25c40b9.tar.gz
Add a av_fast_malloc function and replace several uses of av_fast_realloc,
thus avoiding potential memleaks and pointless memcpys. Originally committed as revision 18470 to svn://svn.ffmpeg.org/ffmpeg/trunk
Diffstat (limited to 'libavcodec/avcodec.h')
-rw-r--r--libavcodec/avcodec.h14
1 files changed, 14 insertions, 0 deletions
diff --git a/libavcodec/avcodec.h b/libavcodec/avcodec.h
index 8edcc01340..50c70d6d1a 100644
--- a/libavcodec/avcodec.h
+++ b/libavcodec/avcodec.h
@@ -3541,6 +3541,20 @@ AVBitStreamFilter *av_bitstream_filter_next(AVBitStreamFilter *f);
void *av_fast_realloc(void *ptr, unsigned int *size, unsigned int min_size);
/**
+ * Allocates a buffer, reusing the given one if large enough.
+ *
+ * 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_malloc(void *ptr, unsigned int *size, unsigned int min_size);
+
+/**
* Copy image 'src' to 'dst'.
*/
void av_picture_copy(AVPicture *dst, const AVPicture *src,