X-Git-Url: https://git.sesse.net/?a=blobdiff_plain;f=libavcodec%2Fmss4.c;h=662cf24df50a100f2d76f84c1f80a95844502478;hb=94194bdcd7bfc2137ccd13e5c149567b9a917f4f;hp=fd1f316bbf17cc5c3f945c09d49bcf24436ac43a;hpb=a7663ad9cf74bb0a25c07085e7a8f2b235d0c0cb;p=ffmpeg diff --git a/libavcodec/mss4.c b/libavcodec/mss4.c index fd1f316bbf1..662cf24df50 100644 --- a/libavcodec/mss4.c +++ b/libavcodec/mss4.c @@ -626,14 +626,23 @@ static int mss4_decode_frame(AVCodecContext *avctx, void *data, int *got_frame, return buf_size; } -static av_cold int mss4_decode_init(AVCodecContext *avctx) +static av_cold int mss4_decode_end(AVCodecContext *avctx) { MSS4Context * const c = avctx->priv_data; int i; - c->pic = av_frame_alloc(); - if (!c->pic) - return AVERROR(ENOMEM); + av_frame_free(&c->pic); + for (i = 0; i < 3; i++) + av_freep(&c->prev_dc[i]); + mss4_free_vlcs(c); + + return 0; +} + +static av_cold int mss4_decode_init(AVCodecContext *avctx) +{ + MSS4Context * const c = avctx->priv_data; + int i; if (mss4_init_vlcs(c)) { av_log(avctx, AV_LOG_ERROR, "Cannot initialise VLCs\n"); @@ -650,21 +659,13 @@ static av_cold int mss4_decode_init(AVCodecContext *avctx) } } - avctx->pix_fmt = AV_PIX_FMT_YUV444P; - - return 0; -} - -static av_cold int mss4_decode_end(AVCodecContext *avctx) -{ - MSS4Context * const c = avctx->priv_data; - int i; - - av_frame_free(&c->pic); + c->pic = av_frame_alloc(); + if (!c->pic) { + mss4_decode_end(avctx); + return AVERROR(ENOMEM); + } - for (i = 0; i < 3; i++) - av_freep(&c->prev_dc[i]); - mss4_free_vlcs(c); + avctx->pix_fmt = AV_PIX_FMT_YUV444P; return 0; }