X-Git-Url: https://git.sesse.net/?a=blobdiff_plain;f=libavcodec%2Feacmv.c;h=b239acffda0c85f5d7ffed104f0aeb1e73c65106;hb=e83717e63eab1f1b78dc0990e5b8e927097fca29;hp=bf4404ce4263531a53605a8cd259af3b635d5267;hpb=73d193d1d0ff62a029a905d1404c0fd357f4c880;p=ffmpeg diff --git a/libavcodec/eacmv.c b/libavcodec/eacmv.c index bf4404ce426..b239acffda0 100644 --- a/libavcodec/eacmv.c +++ b/libavcodec/eacmv.c @@ -50,11 +50,8 @@ static av_cold int cmv_decode_init(AVCodecContext *avctx){ s->last_frame = av_frame_alloc(); s->last2_frame = av_frame_alloc(); - if (!s->last_frame || !s->last2_frame) { - av_frame_free(&s->last_frame); - av_frame_free(&s->last2_frame); + if (!s->last_frame || !s->last2_frame) return AVERROR(ENOMEM); - } return 0; } @@ -191,12 +188,12 @@ static int cmv_decode_frame(AVCodecContext *avctx, if (ret < 0) return ret; if (size > buf_end - buf - EA_PREAMBLE_SIZE) - return -1; + return AVERROR_INVALIDDATA; buf += size; } - if (av_image_check_size(s->width, s->height, 0, s->avctx)) - return -1; + if ((ret = av_image_check_size(s->width, s->height, 0, s->avctx)) < 0) + return ret; if ((ret = ff_get_buffer(avctx, frame, AV_GET_BUFFER_FLAG_REF)) < 0) return ret; @@ -243,4 +240,5 @@ AVCodec ff_eacmv_decoder = { .close = cmv_decode_end, .decode = cmv_decode_frame, .capabilities = AV_CODEC_CAP_DR1, + .caps_internal = FF_CODEC_CAP_INIT_CLEANUP, };