diff mbox series

[FFmpeg-devel] avcodec/videotoolboxenc: Fix leaking of supported_props

Message ID tencent_F9ABE544F31DC843F3EB5366F5C969032E05@qq.com
State New
Headers show
Series [FFmpeg-devel] avcodec/videotoolboxenc: Fix leaking of supported_props | expand

Checks

Context Check Description
yinshiyou/make_loongarch64 success Make finished
yinshiyou/make_fate_loongarch64 success Make fate finished
andriy/make_x86 success Make finished
andriy/make_fate_x86 success Make fate finished

Commit Message

Zhao Zhili Aug. 23, 2024, 5:09 p.m. UTC
From: Zhao Zhili <zhilizhao@tencent.com>

There are two VTCompressionSessionRef been created, one for generating
extradata, and another for normal encoding. supported_props was been
overwritten without release.
---
 libavcodec/videotoolboxenc.c | 4 ++++
 1 file changed, 4 insertions(+)
diff mbox series

Patch

diff --git a/libavcodec/videotoolboxenc.c b/libavcodec/videotoolboxenc.c
index 78ef474d7a..f4070571d3 100644
--- a/libavcodec/videotoolboxenc.c
+++ b/libavcodec/videotoolboxenc.c
@@ -1205,6 +1205,10 @@  static int vtenc_create_encoder(AVCodecContext   *avctx,
 
 #if defined (MAC_OS_X_VERSION_10_13) && (MAC_OS_X_VERSION_MAX_ALLOWED >= MAC_OS_X_VERSION_10_13)
     if (__builtin_available(macOS 10.13, *)) {
+        if (vtctx->supported_props) {
+            CFRelease(vtctx->supported_props);
+            vtctx->supported_props = NULL;
+        }
         status = VTCopySupportedPropertyDictionaryForEncoder(avctx->width,
                                                              avctx->height,
                                                              codec_type,