PR #21069 opened by Jack Lau (JackLau) URL: https://code.ffmpeg.org/FFmpeg/FFmpeg/pulls/21069 Patch URL: https://code.ffmpeg.org/FFmpeg/FFmpeg/pulls/21069.patch
The buffer is prepared for avio, so we need to free the buffer at the end when avio_alloc_context() fails, otherwise, it will cause memleak. Signed-off-by: Jack Lau <[email protected]> >From 96bc53bcfded47a6c2043a9b9e3ab8b9570cb819 Mon Sep 17 00:00:00 2001 From: Jack Lau <[email protected]> Date: Mon, 24 Nov 2025 10:16:17 +0800 Subject: [PATCH] avformat/whip: fix memleak when avio_alloc_context() fails The buffer is prepared for avio, so we need to free the buffer at the end when avio_alloc_context() fails, otherwise, it will cause memleak. Signed-off-by: Jack Lau <[email protected]> --- libavformat/whip.c | 5 ++++- 1 file changed, 4 insertions(+), 1 deletion(-) diff --git a/libavformat/whip.c b/libavformat/whip.c index 6a9b208f69..7d4017d83f 100644 --- a/libavformat/whip.c +++ b/libavformat/whip.c @@ -1643,8 +1643,11 @@ static int create_rtp_muxer(AVFormatContext *s) ELAPSED(whip->whip_dtls_time, whip->whip_srtp_time)); end: - if (rtp_ctx) + if (rtp_ctx) { + if (!rtp_ctx->pb) + av_freep(&buffer); avio_context_free(&rtp_ctx->pb); + } avformat_free_context(rtp_ctx); av_dict_free(&opts); return ret; -- 2.49.1 _______________________________________________ ffmpeg-devel mailing list -- [email protected] To unsubscribe send an email to [email protected]
