This is an automated email from the git hooks/post-receive script.

Git pushed a commit to branch master
in repository ffmpeg.

commit c2c99c6296aba761aa9147ab6617dc6498a0de41
Author:     Michael Niedermayer <[email protected]>
AuthorDate: Sat Nov 28 22:44:15 2026 +0100
Commit:     michaelni <[email protected]>
CommitDate: Sun Nov 29 23:57:24 2026 +0000

    avformat/whip: fix double free of the RTP buffer of an earlier stream
    
    create_rtp_muxer() freed buffer whenever it failed without an
    AVIOContext. If avformat_new_stream() fails for the second stream,
    buffer still points to the buffer owned by the AVIOContext of the
    first stream, which whip_deinit() frees again.
    
    Free the buffer where avio_alloc_context() fails instead.
    
    Regression since d15a9d5961e6f9a0cb8c1c9d692ce9b985b58db2
    
    Found during review of d15a9d5961e6f9a0cb8c1c9d692ce9b985b58db2 for 
backporting to release/8.0
    
    Fixes: double free
    Fixes: lSGLiHjcvXKW
    
    Double free Replicated through Modified FFmpeg with ASAN
---
 libavformat/whip.c | 6 ++----
 1 file changed, 2 insertions(+), 4 deletions(-)

diff --git a/libavformat/whip.c b/libavformat/whip.c
index 5bd6dd609b..114e098985 100644
--- a/libavformat/whip.c
+++ b/libavformat/whip.c
@@ -655,6 +655,7 @@ static int create_rtp_muxer(AVFormatContext *s)
 
         rtp_ctx->pb = avio_alloc_context(buffer, buffer_size, 1, s, NULL, 
on_rtp_write_packet, NULL);
         if (!rtp_ctx->pb) {
+            av_free(buffer);
             ret = AVERROR(ENOMEM);
             goto end;
         }
@@ -692,11 +693,8 @@ static int create_rtp_muxer(AVFormatContext *s)
         RTC_ELAPSED(rtc->dtls_time,   rtc->srtp_time));
 
 end:
-    if (rtp_ctx) {
-        if (!rtp_ctx->pb)
-            av_freep(&buffer);
+    if (rtp_ctx)
         avio_context_free(&rtp_ctx->pb);
-    }
     avformat_free_context(rtp_ctx);
     av_dict_free(&opts);
     return ret;

-- 
To stop receiving notification emails like this one, please contact
[email protected].
_______________________________________________
ffmpeg-cvslog mailing list -- [email protected]
To unsubscribe send an email to [email protected]

Reply via email to