[FFmpeg-devel] [PATCH] avutil/hwcontext_vulkan: Fix memleaks when transfer to vulkan

Zhao Zhili quinkblack at foxmail.com
Tue Feb 20 16:27:04 EET 2024


From: Zhao Zhili <zhilizhao at tencent.com>

Without ff_vk_exec_discard_deps which is called by ff_vk_exec_wait,
the reference count of hwframe context cannot reach zero due to
circular reference created by ff_vk_exec_add_dep_frame.

Fix #10873
---
 libavutil/hwcontext_vulkan.c | 4 +---
 1 file changed, 1 insertion(+), 3 deletions(-)

diff --git a/libavutil/hwcontext_vulkan.c b/libavutil/hwcontext_vulkan.c
index a84713e621..d660f63afe 100644
--- a/libavutil/hwcontext_vulkan.c
+++ b/libavutil/hwcontext_vulkan.c
@@ -3393,9 +3393,7 @@ static int transfer_image_buf(AVHWFramesContext *hwfc, AVFrame *f,
     if (err < 0)
         return err;
 
-    /* Wait for the operation to complete when downloading */
-    if (to_buf)
-        ff_vk_exec_wait(&p->vkctx, exec);
+    ff_vk_exec_wait(&p->vkctx, exec);
 
     return 0;
 }
-- 
2.34.1



More information about the ffmpeg-devel mailing list