1
0
mirror of https://github.com/FFmpeg/FFmpeg.git synced 2024-12-23 12:43:46 +02:00

Merge commit 'f3d57dc69145f1b7acb4870da9ce60378190a1fd'

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

Conflicts:
	libavcodec/smacker.c

Merged-by: Michael Niedermayer <michaelni@gmx.at>
This commit is contained in:
Michael Niedermayer 2013-09-12 12:57:58 +02:00
commit af539319af

View File

@ -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 * Init smacker decoder
@ -571,8 +591,10 @@ static av_cold int decode_init(AVCodecContext *avctx)
} }
ret = decode_header_trees(c); ret = decode_header_trees(c);
if (ret < 0) if (ret < 0) {
decode_end(avctx);
return ret; return ret;
}
c->pic = av_frame_alloc(); c->pic = av_frame_alloc();
if (!c->pic) 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) static av_cold int smka_decode_init(AVCodecContext *avctx)
{ {
if (avctx->channels < 1 || avctx->channels > 2) { if (avctx->channels < 1 || avctx->channels > 2) {