[FFmpeg-cvslog] avcodec/vb: Check for av_mallocz() failure

Michael Niedermayer git at videolan.org
Mon Feb 9 09:59:59 CET 2015


ffmpeg | branch: master | Michael Niedermayer <michaelni at gmx.at> | Mon Feb  9 09:27:16 2015 +0100| [d80fe5d4bce3503390513ab7b7dbc634cacade40] | committer: Michael Niedermayer

avcodec/vb: Check for av_mallocz() failure

Signed-off-by: Michael Niedermayer <michaelni at gmx.at>

> http://git.videolan.org/gitweb.cgi/ffmpeg.git/?a=commit;h=d80fe5d4bce3503390513ab7b7dbc634cacade40
---

 libavcodec/vb.c |    6 ++++++
 1 file changed, 6 insertions(+)

diff --git a/libavcodec/vb.c b/libavcodec/vb.c
index 3c89a29..41ee42e 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;
 }
 



More information about the ffmpeg-cvslog mailing list