diff options
Diffstat (limited to 'libavcodec/xan.c')
-rw-r--r-- | libavcodec/xan.c | 27 |
1 files changed, 13 insertions, 14 deletions
diff --git a/libavcodec/xan.c b/libavcodec/xan.c index 33bc0b068f..7489113cf7 100644 --- a/libavcodec/xan.c +++ b/libavcodec/xan.c @@ -71,7 +71,18 @@ typedef struct XanContext { } XanContext; -static av_cold int xan_decode_end(AVCodecContext *avctx); +static av_cold int xan_decode_end(AVCodecContext *avctx) +{ + XanContext *s = avctx->priv_data; + + av_frame_free(&s->last_frame); + + av_freep(&s->buffer1); + av_freep(&s->buffer2); + av_freep(&s->palettes); + + return 0; +} static av_cold int xan_decode_init(AVCodecContext *avctx) { @@ -92,6 +103,7 @@ static av_cold int xan_decode_init(AVCodecContext *avctx) av_freep(&s->buffer1); return AVERROR(ENOMEM); } + s->last_frame = av_frame_alloc(); if (!s->last_frame) { xan_decode_end(avctx); @@ -623,19 +635,6 @@ static int xan_decode_frame(AVCodecContext *avctx, return buf_size; } -static av_cold int xan_decode_end(AVCodecContext *avctx) -{ - XanContext *s = avctx->priv_data; - - av_frame_free(&s->last_frame); - - av_freep(&s->buffer1); - av_freep(&s->buffer2); - av_freep(&s->palettes); - - return 0; -} - AVCodec ff_xan_wc3_decoder = { .name = "xan_wc3", .long_name = NULL_IF_CONFIG_SMALL("Wing Commander III / Xan"), |