diff options
author | Michael Niedermayer <michael@niedermayer.cc> | 2019-06-15 22:52:24 +0300 |
---|---|---|
committer | Michael Niedermayer <michael@niedermayer.cc> | 2019-06-16 10:56:43 +0300 |
commit | 2603f25d326476a83f5d093b522590b05b6e703b (patch) | |
tree | 89fbf39ba36559ef258195c79f7e6c39a390acb1 /libavcodec/bink.c | |
parent | dd357d76e5faf3ce6fc46ffb924cf30f1cb54af9 (diff) |
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>
Diffstat (limited to 'libavcodec/bink.c')
-rw-r--r-- | libavcodec/bink.c | 6 |
1 files changed, 3 insertions, 3 deletions
diff --git a/libavcodec/bink.c b/libavcodec/bink.c index d0f1b39321..8392bbeeb0 100644 --- a/libavcodec/bink.c +++ b/libavcodec/bink.c @@ -1333,13 +1333,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; avctx->color_range = c->version == 'k' ? AVCOL_RANGE_JPEG : AVCOL_RANGE_MPEG; |