[FFmpeg-cvslog] hwcontext_vulkan: close exported memory FD on CUDA import error

Lynne git at videolan.org
Sat Nov 13 01:42:12 EET 2021


ffmpeg | branch: master | Lynne <dev at lynne.ee> | Sat Nov 13 00:40:46 2021 +0100| [0d1992e0255ab5cdc026e9190f7b7a114bdeef74] | committer: Lynne

hwcontext_vulkan: close exported memory FD on CUDA import error

Prevents resource leakage.

> http://git.videolan.org/gitweb.cgi/ffmpeg.git/?a=commit;h=0d1992e0255ab5cdc026e9190f7b7a114bdeef74
---

 libavutil/hwcontext_vulkan.c | 1 +
 1 file changed, 1 insertion(+)

diff --git a/libavutil/hwcontext_vulkan.c b/libavutil/hwcontext_vulkan.c
index 0dbbb9d12f..c95c08ff52 100644
--- a/libavutil/hwcontext_vulkan.c
+++ b/libavutil/hwcontext_vulkan.c
@@ -2676,6 +2676,7 @@ static int vulkan_export_to_cuda(AVHWFramesContext *hwfc,
 
             ret = CHECK_CU(cu->cuImportExternalMemory(&dst_int->ext_mem[i], &ext_desc));
             if (ret < 0) {
+                close(ext_desc.handle.fd);
                 err = AVERROR_EXTERNAL;
                 goto fail;
             }



More information about the ffmpeg-cvslog mailing list