PR #24850 opened by Leo Bicknell (bicknell) URL: https://code.ffmpeg.org/FFmpeg/FFmpeg/pulls/24850 Patch URL: https://code.ffmpeg.org/FFmpeg/FFmpeg/pulls/24850.patch
# Summary of changes The CFNumber holding the bitrate was not released when the encoder rejected kVTCompressionPropertyKey_ConstantBitRate. The early return on that error path skipped the CFRelease that the normal path performs. The leak has been present since the constant_bit_rate option was added in 47b85c5a76. # Testing Built and ran `make fate` locally on macOS 27.0.1 (Apple M5 Max). The Forgejo CI has no macOS runner, so it does not build this file. # Disclosure An AI assistant was used to help find and write this fix. I have reviewed the change and tested it myself. This is my first PR to the ffmpeg project, and found this bug while testing a more substantial submission I hope to make in a few days. If I performed any of the process wrong please let me know so I can correct before my larger submission. >From 9284c1c30757d88fee7415bc9b5851faa768b103 Mon Sep 17 00:00:00 2001 From: Leo Bicknell <[email protected]> Date: Thu, 1 Oct 2026 18:23:03 -0400 Subject: [PATCH] avcodec/videotoolboxenc: fix leak when constant bitrate is not supported The CFNumber holding the bitrate was not released when the encoder rejected kVTCompressionPropertyKey_ConstantBitRate. Signed-off-by: Leo Bicknell <[email protected]> --- libavcodec/videotoolboxenc.c | 1 + 1 file changed, 1 insertion(+) diff --git a/libavcodec/videotoolboxenc.c b/libavcodec/videotoolboxenc.c index aa5e4313b9..7dc8c2ac75 100644 --- a/libavcodec/videotoolboxenc.c +++ b/libavcodec/videotoolboxenc.c @@ -1267,6 +1267,7 @@ static int vtenc_create_encoder(AVCodecContext *avctx, bit_rate_num); if (status == kVTPropertyNotSupportedErr) { av_log(avctx, AV_LOG_ERROR, "-constant_bit_rate true is not supported by the encoder.\n"); + CFRelease(bit_rate_num); return AVERROR_EXTERNAL; } } else { -- 2.52.0 _______________________________________________ ffmpeg-devel mailing list -- [email protected] To unsubscribe send an email to [email protected]
