LATM/AAC: Free previously initialized context on reinit.
authorRonald S. Bultje <rsbultje@gmail.com>
Fri, 20 May 2011 14:49:20 +0000 (10:49 -0400)
committerDiego Biurrun <diego@biurrun.de>
Fri, 20 May 2011 16:24:53 +0000 (18:24 +0200)
Fixes memory leaks which are the result of overwriting already-initialized
MDCT contexts during context reinitialization, e.g. in valgrind
fate-aac-latm_000000001180bc60.

Signed-off-by: Diego Biurrun <diego@biurrun.de>
libavcodec/aacdec.c

index f2d50f4..fbb3582 100644 (file)
@@ -2464,6 +2464,7 @@ static int latm_decode_frame(AVCodecContext *avctx, void *out, int *out_size,
             *out_size = 0;
             return avpkt->size;
         } else {
+            aac_decode_close(avctx);
             if ((err = aac_decode_init(avctx)) < 0)
                 return err;
             latmctx->initialized = 1;