From 0d1992e0255ab5cdc026e9190f7b7a114bdeef74 Mon Sep 17 00:00:00 2001 From: Lynne Date: Sat, 13 Nov 2021 00:40:46 +0100 Subject: [PATCH] hwcontext_vulkan: close exported memory FD on CUDA import error Prevents resource leakage. --- 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; }