[FFmpeg-devel] [PATCH] bink: fix leaking last frame on error

Andreas Cadhalpun andreas.cadhalpun at googlemail.com
Thu Feb 16 02:26:00 EET 2017


Signed-off-by: Andreas Cadhalpun <Andreas.Cadhalpun at googlemail.com>
---
 libavcodec/bink.c | 8 ++++----
 1 file changed, 4 insertions(+), 4 deletions(-)

diff --git a/libavcodec/bink.c b/libavcodec/bink.c
index cc55870114..91004a6ae5 100644
--- a/libavcodec/bink.c
+++ b/libavcodec/bink.c
@@ -1299,10 +1299,6 @@ static av_cold int decode_init(AVCodecContext *avctx)
     }
     c->avctx = avctx;
 
-    c->last = av_frame_alloc();
-    if (!c->last)
-        return AVERROR(ENOMEM);
-
     if ((ret = av_image_check_size(avctx->width, avctx->height, 0, avctx)) < 0)
         return ret;
 
@@ -1317,6 +1313,10 @@ static av_cold int decode_init(AVCodecContext *avctx)
         return ret;
     }
 
+    c->last = av_frame_alloc();
+    if (!c->last)
+        return AVERROR(ENOMEM);
+
     if (c->version == 'b') {
         if (!binkb_initialised) {
             binkb_calc_quant();
-- 
2.11.0


More information about the ffmpeg-devel mailing list