Message ID | NWZse6z--3-9@lynne.ee |
---|---|
State | New |
Headers | show |
Series | [FFmpeg-devel] vulkan_decode: check if yuv_sampler exists before freeing it | expand |
Context | Check | Description |
---|---|---|
yinshiyou/make_loongarch64 | success | Make finished |
yinshiyou/make_fate_loongarch64 | success | Make fate finished |
andriy/make_x86 | success | Make finished |
andriy/make_fate_x86 | success | Make fate finished |
On Mon, 29 May 2023 02:22:34 +0200 (CEST) Lynne <dev@lynne.ee> wrote: > No Vulkan function is NULL-safe, for no real reason, despite > the language defining and returning VK_NULL_HANDLE. > > Patch attached. > Tested and works. I will note that both the function and s->hwctx are null in the failure case and if ctx->sampler could exist without those also being non-null, you could segfault again. I assume this won't happen in practice. ship it. --phil
May 29, 2023, 03:20 by philipl@overt.org: > On Mon, 29 May 2023 02:22:34 +0200 (CEST) > Lynne <dev@lynne.ee> wrote: > >> No Vulkan function is NULL-safe, for no real reason, despite >> the language defining and returning VK_NULL_HANDLE. >> >> Patch attached. >> > > Tested and works. I will note that both the function and s->hwctx are > null in the failure case and if ctx->sampler could exist without those > also being non-null, you could segfault again. I assume this won't > happen in practice. > > ship it. > Pushed with a better description of what it fixes.
From 60f73541330ae33f92b862250e7f3c928394c0b9 Mon Sep 17 00:00:00 2001 From: Lynne <dev@lynne.ee> 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