Commit dbe7ccee05 for ffmpeg
commit dbe7ccee05828da41c5eda9ca874a6a514534ea6
Author: Michael Niedermayer <michael@niedermayer.cc>
Date: Sun Oct 11 07:19:21 2026 +0200
avcodec/aac/aacdec_usac: release the extension payload buffers before clearing the configuration
The buffers of fragmented extension payloads were lost when a new
configuration was parsed.
Fixes: memleak
Fixes: yxoDgZkJaJ4D
Regression since: eee5fa0808
Found during the review of https://code.ffmpeg.org/FFmpeg/FFmpeg/pulls/24677
Memleak Replicated through UnModified FFmpeg with ASAN
diff --git a/libavcodec/aac/aacdec_usac.c b/libavcodec/aac/aacdec_usac.c
index 3587c76c07..5c6d04226d 100644
--- a/libavcodec/aac/aacdec_usac.c
+++ b/libavcodec/aac/aacdec_usac.c
@@ -571,6 +571,8 @@ int ff_aac_usac_config_decode(AACDecContext *ac, AVCodecContext *avctx,
if (!ac)
return AVERROR_PATCHWELCOME;
+ for (int i = 0; i < usac->nb_elems; i++)
+ av_refstruct_unref(&usac->elems[i].ext.pl_buf);
memset(usac, 0, sizeof(*usac));
usac->loudness.input_method_val = -1;