summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--libavcodec/vb.c6
1 files changed, 6 insertions, 0 deletions
diff --git a/libavcodec/vb.c b/libavcodec/vb.c
index 3c89a2986e..41ee42eca5 100644
--- a/libavcodec/vb.c
+++ b/libavcodec/vb.c
@@ -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;
}