]> git.sesse.net Git - ffmpeg/commitdiff
apedec: check for data buffer realloc failure
authorJustin Ruggles <justin.ruggles@gmail.com>
Tue, 11 Oct 2011 16:47:11 +0000 (12:47 -0400)
committerJustin Ruggles <justin.ruggles@gmail.com>
Fri, 28 Oct 2011 15:47:27 +0000 (11:47 -0400)
libavcodec/apedec.c

index a754fd75b0992a99499e61b9dea9294952c7d9fe..2041e2b3c528b448d5bf903842887a5af0e42386 100644 (file)
@@ -824,7 +824,10 @@ static int ape_decode_frame(AVCodecContext *avctx,
     }
 
     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->ptr = s->last_ptr = s->data;
         s->data_end = s->data + buf_size;