PR #26172 opened by Peter Krefting (nafmo)
URL: https://code.ffmpeg.org/FFmpeg/FFmpeg/pulls/26172
Patch URL: https://code.ffmpeg.org/FFmpeg/FFmpeg/pulls/26172.patch

While looking for an unrelated memory leak, debug printouts shows a leak inside 
the AES decoding routines. I see this leak when decoding an SampleAES encoded 
HLS stream through the libavformat API.


>From 075fcdaf71623f90b4f29596e3f5292c3ffdcbcc Mon Sep 17 00:00:00 2001
From: Peter Krefting <[email protected]>
Date: Wed, 18 Nov 2026 14:49:26 +0100
Subject: [PATCH] avformat/mov: Fix memory leak

The AES context allocated by cbc1_scheme_decrypt() or
cbcs_scheme_decrypt() was never cleaned up.

Found-by: Claude Opus 5.5
---
 libavformat/mov.c | 1 +
 1 file changed, 1 insertion(+)

diff --git a/libavformat/mov.c b/libavformat/mov.c
index 97f26cf28ba..85936bf8252 100644
--- a/libavformat/mov.c
+++ b/libavformat/mov.c
@@ -11033,6 +11033,7 @@ static void mov_free_stream_context(AVFormatContext *s, 
AVStream *st)
     mov_free_encryption_index(&sc->cenc.encryption_index);
     av_encryption_info_free(sc->cenc.default_encrypted_sample);
     av_aes_ctr_free(sc->cenc.aes_ctr);
+    av_freep(&sc->cenc.aes_ctx);
 
     av_freep(&sc->stereo3d);
     av_freep(&sc->spherical);
-- 
2.54.0

_______________________________________________
ffmpeg-devel mailing list -- [email protected]
To unsubscribe send an email to [email protected]

Reply via email to