wmaprodec: fix leaking fdsp on init failure
authorAndreas Cadhalpun <Andreas.Cadhalpun@googlemail.com>
Wed, 15 Feb 2017 23:54:31 +0000 (00:54 +0100)
committerAndreas Cadhalpun <Andreas.Cadhalpun@googlemail.com>
Fri, 17 Feb 2017 00:45:19 +0000 (01:45 +0100)
Reviewed-by: Michael Niedermayer <michael@niedermayer.cc>
Signed-off-by: Andreas Cadhalpun <Andreas.Cadhalpun@googlemail.com>
libavcodec/wmaprodec.c

index 4d53026..1ad1e23 100644 (file)
@@ -323,9 +323,6 @@ static av_cold int decode_init(WMAProDecodeCtx *s, AVCodecContext *avctx)
     }
 
     s->avctx = avctx;
-    s->fdsp = avpriv_float_dsp_alloc(avctx->flags & AV_CODEC_FLAG_BITEXACT);
-    if (!s->fdsp)
-        return AVERROR(ENOMEM);
 
     init_put_bits(&s->pb, s->frame_data, MAX_FRAMESIZE);
 
@@ -523,6 +520,10 @@ static av_cold int decode_init(WMAProDecodeCtx *s, AVCodecContext *avctx)
         }
     }
 
+    s->fdsp = avpriv_float_dsp_alloc(avctx->flags & AV_CODEC_FLAG_BITEXACT);
+    if (!s->fdsp)
+        return AVERROR(ENOMEM);
+
     /** init MDCT, FIXME: only init needed sizes */
     for (i = 0; i < WMAPRO_BLOCK_SIZES; i++)
         ff_mdct_init(&s->mdct_ctx[i], WMAPRO_BLOCK_MIN_BITS+1+i, 1,