]> git.sesse.net Git - ffmpeg/commitdiff
avcodec/rasc: Move ff_get_buffer() after frame checks
authorMichael Niedermayer <michael@niedermayer.cc>
Tue, 22 Jan 2019 23:19:14 +0000 (00:19 +0100)
committerMichael Niedermayer <michael@niedermayer.cc>
Wed, 30 Jan 2019 23:24:38 +0000 (00:24 +0100)
If the frame1/2 checks fail this avoids doing the allocation of a new frame

Signed-off-by: Michael Niedermayer <michael@niedermayer.cc>
libavcodec/rasc.c

index 6e32c1540e55ac7b043ec690b926d062f48e690f..21fc43f325c761a8f0fec0cd5b87d9baaa75f9e4 100644 (file)
@@ -723,12 +723,12 @@ static int decode_frame(AVCodecContext *avctx,
             return ret;
     }
 
-    if ((ret = ff_get_buffer(avctx, s->frame, 0)) < 0)
-        return ret;
-
     if (!s->frame2->data[0] || !s->frame1->data[0])
         return AVERROR_INVALIDDATA;
 
+    if ((ret = ff_get_buffer(avctx, s->frame, 0)) < 0)
+        return ret;
+
     copy_plane(avctx, s->frame2, s->frame);
     if (avctx->pix_fmt == AV_PIX_FMT_PAL8)
         memcpy(s->frame->data[1], s->frame2->data[1], 1024);