winevulkan: Avoid goto in wine_vkCreateDevice().

Signed-off-by: Józef Kucia <jkucia@codeweavers.com>
Signed-off-by: Alexandre Julliard <julliard@winehq.org>
oldstable
Józef Kucia 2018-03-29 14:53:56 +02:00 committed by Alexandre Julliard
parent a8c06b639e
commit 8fd39cc2ce
1 changed files with 7 additions and 10 deletions

View File

@ -531,8 +531,9 @@ VkResult WINAPI wine_vkCreateDevice(VkPhysicalDevice phys_dev,
&create_info_host, NULL /* allocator */, &object->device); &create_info_host, NULL /* allocator */, &object->device);
if (res != VK_SUCCESS) if (res != VK_SUCCESS)
{ {
ERR("Failed to create device\n"); ERR("Failed to create device.\n");
goto err; wine_vk_device_free(object);
return res;
} }
object->phys_dev = phys_dev; object->phys_dev = phys_dev;
@ -559,8 +560,8 @@ VkResult WINAPI wine_vkCreateDevice(VkPhysicalDevice phys_dev,
object->queues = heap_calloc(max_queue_families, sizeof(*object->queues)); object->queues = heap_calloc(max_queue_families, sizeof(*object->queues));
if (!object->queues) if (!object->queues)
{ {
res = VK_ERROR_OUT_OF_HOST_MEMORY; wine_vk_device_free(object);
goto err; return VK_ERROR_OUT_OF_HOST_MEMORY;
} }
for (i = 0; i < create_info_host.queueCreateInfoCount; i++) for (i = 0; i < create_info_host.queueCreateInfoCount; i++)
@ -573,18 +574,14 @@ VkResult WINAPI wine_vkCreateDevice(VkPhysicalDevice phys_dev,
object->queues[family_index] = wine_vk_device_alloc_queues(object, family_index, queue_count); object->queues[family_index] = wine_vk_device_alloc_queues(object, family_index, queue_count);
if (!object->queues[family_index]) if (!object->queues[family_index])
{ {
res = VK_ERROR_OUT_OF_HOST_MEMORY;
ERR("Failed to allocate memory for queues\n"); ERR("Failed to allocate memory for queues\n");
goto err; wine_vk_device_free(object);
return VK_ERROR_OUT_OF_HOST_MEMORY;
} }
} }
*device = object; *device = object;
return VK_SUCCESS; return VK_SUCCESS;
err:
wine_vk_device_free(object);
return res;
} }
VkResult WINAPI wine_vkCreateInstance(const VkInstanceCreateInfo *create_info, VkResult WINAPI wine_vkCreateInstance(const VkInstanceCreateInfo *create_info,