Commit af539319 authored by Michael Niedermayer's avatar Michael Niedermayer

Merge commit 'f3d57dc6'

* commit 'f3d57dc6':
  smacker: Free memory properly if the init function fails

Conflicts:
	libavcodec/smacker.c
Merged-by: 's avatarMichael Niedermayer <michaelni@gmx.at>
parents f8932d99 f3d57dc6
......@@ -550,6 +550,26 @@ static int decode_frame(AVCodecContext *avctx, void *data, int *got_frame,
/*
*
* Uninit smacker decoder
*
*/
static av_cold int decode_end(AVCodecContext *avctx)
{
SmackVContext * const smk = avctx->priv_data;
av_freep(&smk->mmap_tbl);
av_freep(&smk->mclr_tbl);
av_freep(&smk->full_tbl);
av_freep(&smk->type_tbl);
av_frame_free(&smk->pic);
return 0;
}
/*
*
* Init smacker decoder
......@@ -571,8 +591,10 @@ static av_cold int decode_init(AVCodecContext *avctx)
}
ret = decode_header_trees(c);
if (ret < 0)
if (ret < 0) {
decode_end(avctx);
return ret;
}
c->pic = av_frame_alloc();
if (!c->pic)
......@@ -582,27 +604,6 @@ static av_cold int decode_init(AVCodecContext *avctx)
}
/*
*
* Uninit smacker decoder
*
*/
static av_cold int decode_end(AVCodecContext *avctx)
{
SmackVContext * const smk = avctx->priv_data;
av_freep(&smk->mmap_tbl);
av_freep(&smk->mclr_tbl);
av_freep(&smk->full_tbl);
av_freep(&smk->type_tbl);
av_frame_free(&smk->pic);
return 0;
}
static av_cold int smka_decode_init(AVCodecContext *avctx)
{
if (avctx->channels < 1 || avctx->channels > 2) {
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment