diff mbox series

[FFmpeg-devel,2/4] avutil/hwcontext_vulkan: check if created before destroying the device

Message ID 20211123090119.868788-2-jianhua.wu@intel.com
State New
Headers show
Series [FFmpeg-devel,1/4] avutil/vulkan_functions: add EnumerateInstanceLayerProperties
Related show

Checks

Context Check Description
andriy/make_x86 success Make finished
andriy/make_fate_x86 success Make fate finished
andriy/make_ppc success Make finished
andriy/make_fate_ppc success Make fate finished

Commit Message

Wu, Jianhua Nov. 23, 2021, 9:01 a.m. UTC
Signed-off-by: Wu Jianhua <jianhua.wu@intel.com>
---
 libavutil/hwcontext_vulkan.c | 3 ++-
 1 file changed, 2 insertions(+), 1 deletion(-)
diff mbox series

Patch

diff --git a/libavutil/hwcontext_vulkan.c b/libavutil/hwcontext_vulkan.c
index f1e750cd3e..4ac1058181 100644
--- a/libavutil/hwcontext_vulkan.c
+++ b/libavutil/hwcontext_vulkan.c
@@ -1150,7 +1150,8 @@  static void vulkan_device_free(AVHWDeviceContext *ctx)
     FFVulkanFunctions *vk = &p->vkfn;
     AVVulkanDeviceContext *hwctx = ctx->hwctx;
 
-    vk->DestroyDevice(hwctx->act_dev, hwctx->alloc);
+    if (hwctx->act_dev)
+        vk->DestroyDevice(hwctx->act_dev, hwctx->alloc);
 
     if (p->debug_ctx)
         vk->DestroyDebugUtilsMessengerEXT(hwctx->inst, p->debug_ctx,