From 75e01c8b2d2c2a40b82fda67113e9a08a426fbeb Mon Sep 17 00:00:00 2001 From: =?utf8?q?Kristian=20H=C3=B8gsberg=20Kristensen?= Date: Sun, 3 Jan 2016 21:15:29 -0800 Subject: [PATCH] vk: Only finish wayland wsi if we created it Failure during instance creation will leave instance->wayland_wsi undefined. When we then try to clean that up we crash. Set instance->wayland_wsi to NULL on failure and only clean it up if it's non-NULL. Fixes part of dEQP-VK.api.object_management.alloc_callback_fail.* --- src/vulkan/anv_wsi_wayland.c | 8 +++++--- 1 file changed, 5 insertions(+), 3 deletions(-) diff --git a/src/vulkan/anv_wsi_wayland.c b/src/vulkan/anv_wsi_wayland.c index 79453b594d8..d51a96b9f11 100644 --- a/src/vulkan/anv_wsi_wayland.c +++ b/src/vulkan/anv_wsi_wayland.c @@ -862,9 +862,11 @@ anv_wl_finish_wsi(struct anv_instance *instance) { struct wsi_wayland *wsi = instance->wayland_wsi; - _mesa_hash_table_destroy(wsi->displays, NULL); + if (wsi) { + _mesa_hash_table_destroy(wsi->displays, NULL); - pthread_mutex_destroy(&wsi->mutex); + pthread_mutex_destroy(&wsi->mutex); - anv_free(&instance->alloc, wsi); + anv_free(&instance->alloc, wsi); + } } -- 2.30.2