return 0;
}
+static av_cold int decode_end(AVCodecContext *avctx)
+{
+ IffContext *s = avctx->priv_data;
+ av_frame_free(&s->frame);
+ av_freep(&s->planebuf);
+ av_freep(&s->ham_buf);
+ av_freep(&s->ham_palbuf);
+ return 0;
+}
+
static av_cold int decode_init(AVCodecContext *avctx)
{
IffContext *s = avctx->priv_data;
s->bpp = avctx->bits_per_coded_sample;
s->frame = av_frame_alloc();
- if (!s->frame)
+ if (!s->frame) {
+ decode_end(avctx);
return AVERROR(ENOMEM);
+ }
if ((err = extract_header(avctx, NULL)) < 0)
return err;
return buf_size;
}
-static av_cold int decode_end(AVCodecContext *avctx)
-{
- IffContext *s = avctx->priv_data;
- av_frame_free(&s->frame);
- av_freep(&s->planebuf);
- av_freep(&s->ham_buf);
- av_freep(&s->ham_palbuf);
- return 0;
-}
-
#if CONFIG_IFF_ILBM_DECODER
AVCodec ff_iff_ilbm_decoder = {
.name = "iff",