X-Git-Url: https://git.sesse.net/?a=blobdiff_plain;f=libavcodec%2Fxan.c;h=7ab43db1e08657e1e86d395917f05615fd4edeeb;hb=d07534b5f5f20b4f780f5b0284aca6354da00695;hp=1ccf164847bb70aa963534b399cebd84ac4bf720;hpb=1811b7d1f5330e04a48b1d6425cf1ef6ed776ed1;p=ffmpeg diff --git a/libavcodec/xan.c b/libavcodec/xan.c index 1ccf164847b..7ab43db1e08 100644 --- a/libavcodec/xan.c +++ b/libavcodec/xan.c @@ -100,16 +100,12 @@ static av_cold int xan_decode_init(AVCodecContext *avctx) return AVERROR(ENOMEM); s->buffer2_size = avctx->width * avctx->height; s->buffer2 = av_malloc(s->buffer2_size + 130); - if (!s->buffer2) { - av_freep(&s->buffer1); + if (!s->buffer2) return AVERROR(ENOMEM); - } s->last_frame = av_frame_alloc(); - if (!s->last_frame) { - xan_decode_end(avctx); + if (!s->last_frame) return AVERROR(ENOMEM); - } return 0; } @@ -639,7 +635,7 @@ static int xan_decode_frame(AVCodecContext *avctx, return buf_size; } -AVCodec ff_xan_wc3_decoder = { +const AVCodec ff_xan_wc3_decoder = { .name = "xan_wc3", .long_name = NULL_IF_CONFIG_SMALL("Wing Commander III / Xan"), .type = AVMEDIA_TYPE_VIDEO, @@ -649,4 +645,5 @@ AVCodec ff_xan_wc3_decoder = { .close = xan_decode_end, .decode = xan_decode_frame, .capabilities = AV_CODEC_CAP_DR1, + .caps_internal = FF_CODEC_CAP_INIT_CLEANUP | FF_CODEC_CAP_INIT_THREADSAFE, };