No Vulkan function is NULL-safe, for no real reason, despite
the language defining and returning VK_NULL_HANDLE.

Patch attached.

>From 60f73541330ae33f92b862250e7f3c928394c0b9 Mon Sep 17 00:00:00 2001
From: Lynne <[email protected]>
Date: Mon, 29 May 2023 02:04:59 +0200
Subject: [PATCH] vulkan_decode: check if yuv_sampler exists before freeing it

No Vulkan function is NULL-safe, for no real reason, despite
the language defining and returning VK_NULL_HANDLE.
---
 libavcodec/vulkan_decode.c | 5 +++--
 1 file changed, 3 insertions(+), 2 deletions(-)

diff --git a/libavcodec/vulkan_decode.c b/libavcodec/vulkan_decode.c
index 1d1fb9ad97..6138106fef 100644
--- a/libavcodec/vulkan_decode.c
+++ b/libavcodec/vulkan_decode.c
@@ -581,8 +581,9 @@ static void free_common(void *opaque, uint8_t *data)
 
     ff_vk_video_common_uninit(s, &ctx->common);
 
-    vk->DestroySamplerYcbcrConversion(s->hwctx->act_dev, ctx->yuv_sampler,
-                                      s->hwctx->alloc);
+    if (ctx->yuv_sampler)
+        vk->DestroySamplerYcbcrConversion(s->hwctx->act_dev, ctx->yuv_sampler,
+                                          s->hwctx->alloc);
 
     ff_vk_uninit(s);
 }
-- 
2.40.1

_______________________________________________
ffmpeg-devel mailing list
[email protected]
https://ffmpeg.org/mailman/listinfo/ffmpeg-devel

To unsubscribe, visit link above, or email
[email protected] with subject "unsubscribe".

Reply via email to