diff options
author | Reimar Döffinger <Reimar.Doeffinger@gmx.de> | 2012-01-15 14:26:55 +0100 |
---|---|---|
committer | Reimar Döffinger <Reimar.Doeffinger@gmx.de> | 2012-01-17 20:16:35 +0100 |
commit | 3b55429d5692dd782d8b3ce6a19819305157d1b8 (patch) | |
tree | 489c7014c1e3843253cb17e53f3d3950967b312f /libavcodec/avcodec.h | |
parent | a129622390fca8a298c3b121f42b2d15910b9b22 (diff) | |
download | ffmpeg-3b55429d5692dd782d8b3ce6a19819305157d1b8.tar.gz |
Add and use av_fast_padded_malloc.
The same as av_fast_malloc but uses av_mallocz and keeps extra
always-0 padding.
This does not mean the memory will be 0-initialized after each call,
but actually only after each growth of the buffer.
However this makes sure that
a) all data anywhere in the buffer is always initialized
b) the padding is always 0
c) the user does not have to bother with adding the padding themselves
Fixes another valgrind warning about use of uninitialized data,
this time with fate-vsynth1-jpegls.
Signed-off-by: Reimar Döffinger <Reimar.Doeffinger@gmx.de>
Diffstat (limited to 'libavcodec/avcodec.h')
-rw-r--r-- | libavcodec/avcodec.h | 9 |
1 files changed, 9 insertions, 0 deletions
diff --git a/libavcodec/avcodec.h b/libavcodec/avcodec.h index e690c81e12..215bfc9bb4 100644 --- a/libavcodec/avcodec.h +++ b/libavcodec/avcodec.h @@ -4754,6 +4754,15 @@ 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); /** + * Same behaviour av_fast_malloc but the buffer has additional + * FF_INPUT_PADDING_SIZE at the end which will will always be 0. + * + * In addition the whole buffer will initially and after resizes + * be 0-initialized so that no uninitialized data will ever appear. + */ +void av_fast_padded_malloc(void *ptr, unsigned int *size, size_t min_size); + +/** * Copy image src to dst. Wraps av_picture_data_copy() above. */ void av_picture_copy(AVPicture *dst, const AVPicture *src, |