diff mbox

[FFmpeg-devel] wmaprodec: fix leaking fdsp on init failure

Message ID 8450fd05-8f25-bcb1-ad94-0b44b096c34d@googlemail.com
State Accepted
Commit 9ccc6cecd2d0645f5073382360509eb278b239b1
Headers show

Commit Message

Andreas Cadhalpun Feb. 15, 2017, 11:56 p.m. UTC
Signed-off-by: Andreas Cadhalpun <Andreas.Cadhalpun@googlemail.com>
---
 libavcodec/wmaprodec.c | 7 ++++---
 1 file changed, 4 insertions(+), 3 deletions(-)

Comments

Michael Niedermayer Feb. 16, 2017, 2:04 a.m. UTC | #1
On Thu, Feb 16, 2017 at 12:56:38AM +0100, Andreas Cadhalpun wrote:
> Signed-off-by: Andreas Cadhalpun <Andreas.Cadhalpun@googlemail.com>
> ---
>  libavcodec/wmaprodec.c | 7 ++++---
>  1 file changed, 4 insertions(+), 3 deletions(-)

should be ok

thx

[...]
Andreas Cadhalpun Feb. 17, 2017, 12:46 a.m. UTC | #2
On 16.02.2017 03:04, Michael Niedermayer wrote:
> On Thu, Feb 16, 2017 at 12:56:38AM +0100, Andreas Cadhalpun wrote:
>> Signed-off-by: Andreas Cadhalpun <Andreas.Cadhalpun@googlemail.com>
>> ---
>>  libavcodec/wmaprodec.c | 7 ++++---
>>  1 file changed, 4 insertions(+), 3 deletions(-)
> 
> should be ok

Pushed.

Best regards,
Andreas
diff mbox

Patch

diff --git a/libavcodec/wmaprodec.c b/libavcodec/wmaprodec.c
index 4d530264df..1ad1e23541 100644
--- a/libavcodec/wmaprodec.c
+++ b/libavcodec/wmaprodec.c
@@ -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,