aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorMichael Niedermayer <michael@niedermayer.cc>2019-06-15 21:52:24 +0200
committerMichael Niedermayer <michael@niedermayer.cc>2020-07-01 12:11:55 +0200
commit63f5e2fd3b157b301da3f61bd428ef1c8e27674c (patch)
tree2481cd9482e4a820b644917738a9f873ea2f2362
parent09f8ed70770d0df6f3de9f922fd92a766c86645d (diff)
downloadffmpeg-63f5e2fd3b157b301da3f61bd428ef1c8e27674c.tar.gz
avcodec/bink: Reorder operations in init to avoid memleak on error
Fixes: Direct leak of 536 byte(s) in 1 object(s) Fixes: 15266/clusterfuzz-testcase-minimized-ffmpeg_AV_CODEC_ID_BINK_fuzzer-5629530426834944 Found-by: continuous fuzzing process https://github.com/google/oss-fuzz/tree/master/projects/ffmpeg Reviewed-by: Peter Ross <pross@xvid.org> Signed-off-by: Michael Niedermayer <michael@niedermayer.cc> (cherry picked from commit 2603f25d326476a83f5d093b522590b05b6e703b) Signed-off-by: Michael Niedermayer <michael@niedermayer.cc>
-rw-r--r--libavcodec/bink.c6
1 files changed, 3 insertions, 3 deletions
diff --git a/libavcodec/bink.c b/libavcodec/bink.c
index cc55870114..9a4ac246ab 100644
--- a/libavcodec/bink.c
+++ b/libavcodec/bink.c
@@ -1299,13 +1299,13 @@ static av_cold int decode_init(AVCodecContext *avctx)
}
c->avctx = avctx;
+ if ((ret = av_image_check_size(avctx->width, avctx->height, 0, avctx)) < 0)
+ return ret;
+
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;
-
avctx->pix_fmt = c->has_alpha ? AV_PIX_FMT_YUVA420P : AV_PIX_FMT_YUV420P;
ff_blockdsp_init(&c->bdsp, avctx);