avcodec/vb: Check for av_mallocz() failure
authorMichael Niedermayer <michaelni@gmx.at>
Mon, 9 Feb 2015 08:27:16 +0000 (09:27 +0100)
committerMichael Niedermayer <michaelni@gmx.at>
Mon, 9 Feb 2015 08:27:16 +0000 (09:27 +0100)
Signed-off-by: Michael Niedermayer <michaelni@gmx.at>
libavcodec/vb.c

index 3c89a29..41ee42e 100644 (file)
@@ -251,6 +251,12 @@ static av_cold int decode_init(AVCodecContext *avctx)
     c->frame      = av_mallocz(avctx->width * avctx->height);
     c->prev_frame = av_mallocz(avctx->width * avctx->height);
 
+    if (!c->frame || !c->prev_frame) {
+        av_freep(&c->frame);
+        av_freep(&c->prev_frame);
+        return AVERROR(ENOMEM);
+    }
+
     return 0;
 }