diff mbox series

[FFmpeg-devel,20/40] avcodec/atrac1: Cleanup generically after init failure

Message ID 20200914052747.124118-4-andreas.rheinhardt@gmail.com
State Accepted
Commit b0a29d88c83facec70f2a0a8941733f88ddde416
Headers show
Series [FFmpeg-devel,01/16] avcodec/snowdec: Use ff_snow_common_init() directly | expand

Checks

Context Check Description
andriy/default pending
andriy/make success Make finished
andriy/make_fate success Make fate finished

Commit Message

Andreas Rheinhardt Sept. 14, 2020, 5:27 a.m. UTC
Signed-off-by: Andreas Rheinhardt <andreas.rheinhardt@gmail.com>
---
 libavcodec/atrac1.c | 3 +--
 1 file changed, 1 insertion(+), 2 deletions(-)

Comments

Paul B Mahol Sept. 14, 2020, 4:33 p.m. UTC | #1
On Mon, Sep 14, 2020 at 07:27:27AM +0200, Andreas Rheinhardt wrote:
> Signed-off-by: Andreas Rheinhardt <andreas.rheinhardt@gmail.com>
> ---
>  libavcodec/atrac1.c | 3 +--
>  1 file changed, 1 insertion(+), 2 deletions(-)
> 

lgtm
diff mbox series

Patch

diff --git a/libavcodec/atrac1.c b/libavcodec/atrac1.c
index 9ecd49273d..4cfb1061c5 100644
--- a/libavcodec/atrac1.c
+++ b/libavcodec/atrac1.c
@@ -353,7 +353,6 @@  static av_cold int atrac1_decode_init(AVCodecContext *avctx)
         (ret = ff_mdct_init(&q->mdct_ctx[1], 8, 1, -1.0/ (1 << 15))) ||
         (ret = ff_mdct_init(&q->mdct_ctx[2], 9, 1, -1.0/ (1 << 15)))) {
         av_log(avctx, AV_LOG_ERROR, "Error initializing MDCT\n");
-        atrac1_decode_end(avctx);
         return ret;
     }
 
@@ -363,7 +362,6 @@  static av_cold int atrac1_decode_init(AVCodecContext *avctx)
 
     q->fdsp = avpriv_float_dsp_alloc(avctx->flags & AV_CODEC_FLAG_BITEXACT);
     if (!q->fdsp) {
-        atrac1_decode_end(avctx);
         return AVERROR(ENOMEM);
     }
 
@@ -393,4 +391,5 @@  AVCodec ff_atrac1_decoder = {
     .capabilities   = AV_CODEC_CAP_DR1,
     .sample_fmts    = (const enum AVSampleFormat[]) { AV_SAMPLE_FMT_FLTP,
                                                       AV_SAMPLE_FMT_NONE },
+    .caps_internal  = FF_CODEC_CAP_INIT_CLEANUP,
 };