diff options
author | Paweł Hajdan, Jr <phajdan@google.com> | 2013-01-10 10:24:01 -0800 |
---|---|---|
committer | Michael Niedermayer <michaelni@gmx.at> | 2013-01-30 19:54:35 +0100 |
commit | 0451ff295a9f5194c2dee87a9a704b6dcd144ddb (patch) | |
tree | 585a71080b5f9f02baa1512684783993d8bf433f /libavformat/oggparsevorbis.c | |
parent | 4a2da83a787b24c4027aa963d9db9b453e91f413 (diff) | |
download | ffmpeg-0451ff295a9f5194c2dee87a9a704b6dcd144ddb.tar.gz |
oggparsevorbis: use av_realloc consistently
Memory passed to av_realloc cannot be allocated using memalign.
From realloc(3):
The realloc() function changes the size of the memory block pointed to
by ptr to size bytes. (...) Unless ptr is NULL, it must have been returned
by an earlier call to malloc(), calloc() or realloc().
The issue has been found by debugallocation, a part of google-perftools:
http://code.google.com/p/gperftools/ .
Signed-off-by: Paweł Hajdan, Jr <phajdan@google.com>
Signed-off-by: Michael Niedermayer <michaelni@gmx.at>
Diffstat (limited to 'libavformat/oggparsevorbis.c')
-rw-r--r-- | libavformat/oggparsevorbis.c | 6 |
1 files changed, 4 insertions, 2 deletions
diff --git a/libavformat/oggparsevorbis.c b/libavformat/oggparsevorbis.c index 16bcaefd4d..452d8565c1 100644 --- a/libavformat/oggparsevorbis.c +++ b/libavformat/oggparsevorbis.c @@ -173,11 +173,13 @@ static unsigned int fixup_vorbis_headers(AVFormatContext * as, struct oggvorbis_private *priv, uint8_t **buf) { - int i,offset, len; + int i,offset, len, buf_len; unsigned char *ptr; len = priv->len[0] + priv->len[1] + priv->len[2]; - ptr = *buf = av_mallocz(len + len/255 + 64); + buf_len = len + len/255 + 64; + ptr = *buf = av_realloc(NULL, buf_len); + memset(*buf, '\0', buf_len); ptr[0] = 2; offset = 1; |