[FFmpeg-cvslog] vulkan: fix crash in ff_vk_shader_free
Lynne
git at videolan.org
Tue Feb 18 11:45:18 EET 2025
ffmpeg | branch: master | Lynne <dev at lynne.ee> | Mon Feb 17 20:07:26 2025 +0100| [1029f51285ecb8ccca7d37b59409cb0f6ba92ed3] | committer: Lynne
vulkan: fix crash in ff_vk_shader_free
The issue is if a shader fails to compile, shd->desc_layout would
not exist, but nb_descriptor_sets would.
> http://git.videolan.org/gitweb.cgi/ffmpeg.git/?a=commit;h=1029f51285ecb8ccca7d37b59409cb0f6ba92ed3
---
libavutil/vulkan.c | 10 ++++++----
1 file changed, 6 insertions(+), 4 deletions(-)
diff --git a/libavutil/vulkan.c b/libavutil/vulkan.c
index d3ada59334..a868a3b90d 100644
--- a/libavutil/vulkan.c
+++ b/libavutil/vulkan.c
@@ -2595,10 +2595,12 @@ void ff_vk_shader_free(FFVulkanContext *s, FFVulkanShader *shd)
av_free(set->binding_offset);
}
- for (int i = 0; i < shd->nb_descriptor_sets; i++)
- if (shd->desc_layout[i])
- vk->DestroyDescriptorSetLayout(s->hwctx->act_dev, shd->desc_layout[i],
- s->hwctx->alloc);
+ if (shd->desc_layout) {
+ for (int i = 0; i < shd->nb_descriptor_sets; i++)
+ if (shd->desc_layout[i])
+ vk->DestroyDescriptorSetLayout(s->hwctx->act_dev, shd->desc_layout[i],
+ s->hwctx->alloc);
+ }
av_freep(&shd->desc_pool_size);
av_freep(&shd->desc_layout);
More information about the ffmpeg-cvslog
mailing list