Commit 0451ff29 authored by Paweł Hajdan, Jr's avatar Paweł Hajdan, Jr Committed by Michael Niedermayer

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: 's avatarPaweł Hajdan, Jr <phajdan@google.com>
Signed-off-by: 's avatarMichael Niedermayer <michaelni@gmx.at>
parent 4a2da83a
......@@ -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;
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment