From 3954594eb4385eef7cea606bc2bb0b92d19c1705 Mon Sep 17 00:00:00 2001 From: =?utf8?q?Kristian=20H=C3=B8gsberg=20Kristensen?= Date: Sun, 3 Jan 2016 21:31:22 -0800 Subject: [PATCH] vk: Call vk_error when we generate a VK_ERROR --- src/vulkan/anv_wsi_wayland.c | 14 +++++++++----- 1 file changed, 9 insertions(+), 5 deletions(-) diff --git a/src/vulkan/anv_wsi_wayland.c b/src/vulkan/anv_wsi_wayland.c index d51a96b9f11..c9eb51012dc 100644 --- a/src/vulkan/anv_wsi_wayland.c +++ b/src/vulkan/anv_wsi_wayland.c @@ -820,18 +820,20 @@ anv_wl_init_wsi(struct anv_instance *instance) wsi = anv_alloc(&instance->alloc, sizeof(*wsi), 8, VK_SYSTEM_ALLOCATION_SCOPE_OBJECT); - if (!wsi) - return vk_error(VK_ERROR_OUT_OF_HOST_MEMORY); + if (!wsi) { + result = vk_error(VK_ERROR_OUT_OF_HOST_MEMORY); + goto fail; + } wsi->instance = instance; int ret = pthread_mutex_init(&wsi->mutex, NULL); if (ret != 0) { if (ret == ENOMEM) { - result = VK_ERROR_OUT_OF_HOST_MEMORY; + result = vk_error(VK_ERROR_OUT_OF_HOST_MEMORY); } else { /* FINISHME: Choose a better error. */ - result = VK_ERROR_OUT_OF_HOST_MEMORY; + result = vk_error(VK_ERROR_OUT_OF_HOST_MEMORY); } goto fail_alloc; @@ -840,7 +842,7 @@ anv_wl_init_wsi(struct anv_instance *instance) wsi->displays = _mesa_hash_table_create(NULL, _mesa_hash_pointer, _mesa_key_pointer_equal); if (!wsi->displays) { - result = VK_ERROR_OUT_OF_HOST_MEMORY; + result = vk_error(VK_ERROR_OUT_OF_HOST_MEMORY); goto fail_mutex; } @@ -853,6 +855,8 @@ fail_mutex: fail_alloc: anv_free(&instance->alloc, wsi); +fail: + instance->wayland_wsi = NULL; return result; } -- 2.30.2