vulkan: fix ImageView flexible array struct allocation

Same as the previous commit, the compiler may insert padding.
Thanks to Marvin Scholz for pointing this out.
This commit is contained in:
Lynne 2024-10-09 02:37:26 +02:00
parent f5e2914a89
commit 80a0567a2f
No known key found for this signature in database
GPG Key ID: A2FEA5F03F034464

View File

@ -1324,8 +1324,9 @@ int ff_vk_create_imageviews(FFVulkanContext *s, FFVkExecContext *e,
const int nb_images = ff_vk_count_images(vkf);
const int nb_planes = av_pix_fmt_count_planes(hwfc->sw_format);
const size_t buf_size = sizeof(int) + nb_planes*sizeof(VkImageView);
ImageViewCtx *iv = av_mallocz(buf_size);
ImageViewCtx *iv;
const size_t buf_size = sizeof(*iv) + nb_planes*sizeof(VkImageView);
iv = av_mallocz(buf_size);
if (!iv)
return AVERROR(ENOMEM);