From df0575dc21ec3c7b2dde96f1d5b0fca461876c69 Mon Sep 17 00:00:00 2001 From: Hendrik Leppkes Date: Fri, 20 Jul 2012 23:03:32 +0200 Subject: [PATCH] mpegvideo: null out current_picture_ptr when allocation failed This avoids using an uninitialized picture in further decode calls. --- libavcodec/mpegvideo_dec.c | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/libavcodec/mpegvideo_dec.c b/libavcodec/mpegvideo_dec.c index 88facfc39d..66c0c660d9 100644 --- a/libavcodec/mpegvideo_dec.c +++ b/libavcodec/mpegvideo_dec.c @@ -344,8 +344,10 @@ int ff_mpv_frame_start(MpegEncContext *s, AVCodecContext *avctx) pic->reference = 3; } - if (alloc_picture(s, pic) < 0) + if (alloc_picture(s, pic) < 0) { + s->current_picture_ptr = NULL; return -1; + } s->current_picture_ptr = pic; // FIXME use only the vars from current_pic