mirror of https://git.ffmpeg.org/ffmpeg.git
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:
commit
af539319af
|
@ -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) {
|
||||
|
|
Loading…
Reference in New Issue