mirror of
https://gitlab.freedesktop.org/gstreamer/gstreamer.git
synced 2024-11-30 13:41:48 +00:00
vkimagememory: initialize flags and don't crash on errors
This commit is contained in:
parent
b38362e75f
commit
2f11fc029d
1 changed files with 6 additions and 3 deletions
|
@ -147,12 +147,13 @@ _create_info_from_args (VkImageCreateInfo * info, VkFormat format, gsize width,
|
|||
|
||||
info->sType = VK_STRUCTURE_TYPE_IMAGE_CREATE_INFO;
|
||||
info->pNext = NULL;
|
||||
info->flags = 0;
|
||||
info->imageType = VK_IMAGE_TYPE_2D;
|
||||
info->format = format;
|
||||
GST_VK_EXTENT3D (info->extent, width, height, 1);
|
||||
info->mipLevels = 1;
|
||||
info->arrayLayers = 1;
|
||||
info->samples = 1;
|
||||
info->samples = VK_SAMPLE_COUNT_1_BIT;
|
||||
info->tiling = tiling;
|
||||
info->usage = usage;
|
||||
info->sharingMode = VK_SHARING_MODE_EXCLUSIVE;
|
||||
|
@ -200,7 +201,7 @@ _vk_image_mem_new_alloc (GstAllocator * allocator, GstMemory * parent,
|
|||
VkMemoryPropertyFlags mem_prop_flags, gpointer user_data,
|
||||
GDestroyNotify notify)
|
||||
{
|
||||
GstVulkanImageMemory *mem = g_new0 (GstVulkanImageMemory, 1);
|
||||
GstVulkanImageMemory *mem = NULL;
|
||||
GstAllocationParams params = { 0, };
|
||||
VkImageViewCreateInfo view_info;
|
||||
VkImageCreateInfo image_info;
|
||||
|
@ -221,6 +222,7 @@ _vk_image_mem_new_alloc (GstAllocator * allocator, GstMemory * parent,
|
|||
if (gst_vulkan_error_to_g_error (err, &error, "vkCreateImage") < 0)
|
||||
goto vk_error;
|
||||
|
||||
mem = g_new0 (GstVulkanImageMemory, 1);
|
||||
vkGetImageMemoryRequirements (device->device, image, &mem->requirements);
|
||||
|
||||
params.align = mem->requirements.alignment;
|
||||
|
@ -275,7 +277,8 @@ vk_error:
|
|||
|
||||
error:
|
||||
{
|
||||
gst_memory_unref ((GstMemory *) mem);
|
||||
if (mem)
|
||||
gst_memory_unref ((GstMemory *) mem);
|
||||
return NULL;
|
||||
}
|
||||
}
|
||||
|
|
Loading…
Reference in a new issue