From d80fe5d4bce3503390513ab7b7dbc634cacade40 Mon Sep 17 00:00:00 2001 From: Michael Niedermayer Date: Mon, 9 Feb 2015 09:27:16 +0100 Subject: avcodec/vb: Check for av_mallocz() failure Signed-off-by: Michael Niedermayer --- libavcodec/vb.c | 6 ++++++ 1 file changed, 6 insertions(+) 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; } -- cgit v1.2.3