Commit 2603f25d authored by Michael Niedermayer's avatar Michael Niedermayer

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/ffmpegReviewed-by: 's avatarPeter Ross <pross@xvid.org>
Signed-off-by: 's avatarMichael Niedermayer <michael@niedermayer.cc>
parent dd357d76
......@@ -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;
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment