[FFmpeg-devel] [PATCH]Memory leak at mpegaudio decoder when CONFIG_FLOAT defined

FB2000 flybird2k
Sun Jul 18 14:04:59 CEST 2010


When CONFIG_FLOAT is defined, ff_dct_init() get called at decode_init().
This patch calls ff_dct_end() to release memory when finished .

Index: mpegaudiodec_float.c
===================================================================
--- mpegaudiodec_float.c        (revision 24303)
+++ mpegaudiodec_float.c        (working copy)
@@ -80,6 +80,13 @@
     }
 }

+static av_cold int decode_end(AVCodecContext * avctx)
+{
+    MPADecodeContext *s = avctx->priv_data;
+    ff_dct_end(&s->dct);
+    return 0;
+}
+
 #if CONFIG_MP1FLOAT_DECODER
 AVCodec mp1float_decoder =
 {
@@ -89,7 +96,7 @@
     sizeof(MPADecodeContext),
     decode_init,
     NULL,
-    NULL,
+    decode_end,
     decode_frame,
     CODEC_CAP_PARSE_ONLY,
     .flush= flush,
@@ -105,7 +112,7 @@
     sizeof(MPADecodeContext),
     decode_init,
     NULL,
-    NULL,
+    decode_end,
     decode_frame,
     CODEC_CAP_PARSE_ONLY,
     .flush= flush,
@@ -121,7 +128,7 @@
     sizeof(MPADecodeContext),
     decode_init,
     NULL,
-    NULL,
+    decode_end,
     decode_frame,
     CODEC_CAP_PARSE_ONLY,
     .flush= flush,
@@ -137,7 +144,7 @@
     sizeof(MPADecodeContext),
     decode_init,
     NULL,
-    NULL,
+    decode_end,
     decode_frame_adu,
     CODEC_CAP_PARSE_ONLY,
     .flush= flush,



More information about the ffmpeg-devel mailing list