Skip to content

Commit 1029f51

Browse files
committed
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.
1 parent 4dc2ae6 commit 1029f51

File tree

1 file changed

+6
-4
lines changed

1 file changed

+6
-4
lines changed

libavutil/vulkan.c

Lines changed: 6 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -2595,10 +2595,12 @@ void ff_vk_shader_free(FFVulkanContext *s, FFVulkanShader *shd)
25952595
av_free(set->binding_offset);
25962596
}
25972597

2598-
for (int i = 0; i < shd->nb_descriptor_sets; i++)
2599-
if (shd->desc_layout[i])
2600-
vk->DestroyDescriptorSetLayout(s->hwctx->act_dev, shd->desc_layout[i],
2601-
s->hwctx->alloc);
2598+
if (shd->desc_layout) {
2599+
for (int i = 0; i < shd->nb_descriptor_sets; i++)
2600+
if (shd->desc_layout[i])
2601+
vk->DestroyDescriptorSetLayout(s->hwctx->act_dev, shd->desc_layout[i],
2602+
s->hwctx->alloc);
2603+
}
26022604

26032605
av_freep(&shd->desc_pool_size);
26042606
av_freep(&shd->desc_layout);

0 commit comments

Comments
 (0)