avcodec/libtheoraenc: Check for av_fast_realloc() failure
authorMichael Niedermayer <michaelni@gmx.at>
Sun, 22 Feb 2015 01:15:37 +0000 (02:15 +0100)
committerMichael Niedermayer <michaelni@gmx.at>
Sun, 22 Feb 2015 01:18:35 +0000 (02:18 +0100)
Fixes CID1257799
Signed-off-by: Michael Niedermayer <michaelni@gmx.at>
libavcodec/libtheoraenc.c

index c0074af..48f6c07 100644 (file)
@@ -99,8 +99,11 @@ static int get_stats(AVCodecContext *avctx, int eos)
         return AVERROR_EXTERNAL;
     }
     if (!eos) {
-        h->stats = av_fast_realloc(h->stats, &h->stats_size,
+        void *tmp = av_fast_realloc(h->stats, &h->stats_size,
                                    h->stats_offset + bytes);
+        if (!tmp)
+            return AVERROR(ENOMEM);
+        h->stats = tmp;
         memcpy(h->stats + h->stats_offset, buf, bytes);
         h->stats_offset += bytes;
     } else {