diff options
author | Andreas Rheinhardt <andreas.rheinhardt@gmail.com> | 2020-09-14 02:00:11 +0200 |
---|---|---|
committer | Andreas Rheinhardt <andreas.rheinhardt@gmail.com> | 2020-09-18 02:51:31 +0200 |
commit | 2fd3ada931ca1580096704541e2ed55d1d8b9e10 (patch) | |
tree | e7f12a2a2f9fafee32c3d8a5fc39f869c85cd6d1 /libavcodec/cngenc.c | |
parent | 29c5c8fdfb4f7c3fe22260d73e9ade7e54330a7d (diff) | |
download | ffmpeg-2fd3ada931ca1580096704541e2ed55d1d8b9e10.tar.gz |
avcodec/cngenc: Cleanup generically after init failure
Signed-off-by: Andreas Rheinhardt <andreas.rheinhardt@gmail.com>
Diffstat (limited to 'libavcodec/cngenc.c')
-rw-r--r-- | libavcodec/cngenc.c | 5 |
1 files changed, 2 insertions, 3 deletions
diff --git a/libavcodec/cngenc.c b/libavcodec/cngenc.c index 8f23b7555a..b622d7bbda 100644 --- a/libavcodec/cngenc.c +++ b/libavcodec/cngenc.c @@ -58,10 +58,8 @@ static av_cold int cng_encode_init(AVCodecContext *avctx) return ret; p->samples32 = av_malloc_array(avctx->frame_size, sizeof(*p->samples32)); p->ref_coef = av_malloc_array(p->order, sizeof(*p->ref_coef)); - if (!p->samples32 || !p->ref_coef) { - cng_encode_close(avctx); + if (!p->samples32 || !p->ref_coef) return AVERROR(ENOMEM); - } return 0; } @@ -113,4 +111,5 @@ AVCodec ff_comfortnoise_encoder = { .close = cng_encode_close, .sample_fmts = (const enum AVSampleFormat[]){ AV_SAMPLE_FMT_S16, AV_SAMPLE_FMT_NONE }, + .caps_internal = FF_CODEC_CAP_INIT_CLEANUP, }; |