apedec: check for data buffer realloc failure

(cherry picked from commit 11ca8b2d74)

Signed-off-by: Michael Niedermayer <michaelni@gmx.at>
This commit is contained in:
Justin Ruggles
2011-10-11 12:47:11 -04:00
committed by Michael Niedermayer
parent f19b8d9533
commit 43fa5bf55e

View File

@@ -819,7 +819,10 @@ static int ape_decode_frame(AVCodecContext * avctx,
} }
if(!s->samples){ if(!s->samples){
s->data = av_realloc(s->data, (buf_size + 3) & ~3); void *tmp_data = av_realloc(s->data, (buf_size + 3) & ~3);
if (!tmp_data)
return AVERROR(ENOMEM);
s->data = tmp_data;
s->dsp.bswap_buf((uint32_t*)s->data, (const uint32_t*)buf, buf_size >> 2); s->dsp.bswap_buf((uint32_t*)s->data, (const uint32_t*)buf, buf_size >> 2);
s->ptr = s->last_ptr = s->data; s->ptr = s->last_ptr = s->data;
s->data_end = s->data + buf_size; s->data_end = s->data + buf_size;