[FFmpeg-cvslog] avcodec/rasc: Move ff_get_buffer() after frame checks

Michael Niedermayer git at videolan.org
Mon Feb 4 01:50:25 EET 2019


ffmpeg | branch: release/4.1 | Michael Niedermayer <michael at niedermayer.cc> | Wed Jan 23 00:19:14 2019 +0100| [b482e94e59b15efde07326619c3cdab5826d1320] | committer: Michael Niedermayer

avcodec/rasc: Move ff_get_buffer() after frame checks

If the frame1/2 checks fail this avoids doing the allocation of a new frame

Signed-off-by: Michael Niedermayer <michael at niedermayer.cc>
(cherry picked from commit 9f4af97aff899571663342fbe68df8caee30097f)
Signed-off-by: Michael Niedermayer <michael at niedermayer.cc>

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

 libavcodec/rasc.c | 6 +++---
 1 file changed, 3 insertions(+), 3 deletions(-)

diff --git a/libavcodec/rasc.c b/libavcodec/rasc.c
index 6e32c1540e..21fc43f325 100644
--- a/libavcodec/rasc.c
+++ b/libavcodec/rasc.c
@@ -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);



More information about the ffmpeg-cvslog mailing list