The issue is if a shader fails to compile, shd->desc_layout would not exist, but nb_descriptor_sets would.
Unified · Split
| @@ -2595,10 +2595,12 @@ void ff_vk_shader_free(FFVulkanContext *s, FFVulkanShader *shd) · 2594 unmodified lines | |||
| 2595 | av_free(set->binding_offset); | 2595 | av_free(set->binding_offset); |
| 2596 | } | 2596 | } |
| 2597 | 2597 | ||
| 2598 | for (int i = 0; i < shd->nb_descriptor_sets; i++) | 2598 | if (shd->desc_layout) { |
| 2599 | if (shd->desc_layout[i]) | 2599 | for (int i = 0; i < shd->nb_descriptor_sets; i++) |
| 2600 | vk->DestroyDescriptorSetLayout(s->hwctx->act_dev, shd->desc_layout[i], | 2600 | if (shd->desc_layout[i]) |
| 2601 | s->hwctx->alloc); | 2601 | vk->DestroyDescriptorSetLayout(s->hwctx->act_dev, shd->desc_layout[i], |
| 2602 | s->hwctx->alloc); | ||
| 2603 | } | ||
| 2602 | 2604 | ||
| 2603 | av_freep(&shd->desc_pool_size); | 2605 | av_freep(&shd->desc_pool_size); |
| 2604 | av_freep(&shd->desc_layout); | 2606 | av_freep(&shd->desc_layout); |