summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorDaniel Stone <[email protected]>2017-04-28 16:49:47 +0200
committerDaniel Stone <[email protected]>2017-05-19 09:34:52 +0100
commitd9a8bba7f44f7042f0bbd659d0ed342236423dd3 (patch)
treeb9dc72effc366970ef29a1ba95d084ad488effb4
parent688ddb85c8c3357d8e1e9d360c74cd728b128d98 (diff)
vulkan: Fix Wayland uninitialised registry
Untangle the exit cleanup paths so we don't try to use the registry variable before it's been initialised. Signed-off-by: Daniel Stone <[email protected]> Reviewed-by: Lionel Landwerlin <[email protected]> Cc: [email protected]
-rw-r--r--src/vulkan/wsi/wsi_common_wayland.c9
1 files changed, 5 insertions, 4 deletions
diff --git a/src/vulkan/wsi/wsi_common_wayland.c b/src/vulkan/wsi/wsi_common_wayland.c
index cb6dd7968f3..a1904c02b9e 100644
--- a/src/vulkan/wsi/wsi_common_wayland.c
+++ b/src/vulkan/wsi/wsi_common_wayland.c
@@ -273,7 +273,7 @@ wsi_wl_display_create(struct wsi_wayland *wsi, struct wl_display *wl_display)
struct wl_registry *registry = wl_display_get_registry(wl_display);
if (!registry)
- return NULL;
+ goto fail;
wl_registry_add_listener(registry, &registry_listener, display);
@@ -281,24 +281,25 @@ wsi_wl_display_create(struct wsi_wayland *wsi, struct wl_display *wl_display)
wl_display_roundtrip(wl_display);
if (!display->drm)
- goto fail;
+ goto fail_registry;
/* Round-rip to get wl_drm formats and capabilities */
wl_display_roundtrip(wl_display);
/* We need prime support */
if (!(display->capabilities & WL_DRM_CAPABILITY_PRIME))
- goto fail;
+ goto fail_registry;
/* We don't need this anymore */
wl_registry_destroy(registry);
return display;
-fail:
+fail_registry:
if (registry)
wl_registry_destroy(registry);
+fail:
wsi_wl_display_destroy(wsi, display);
return NULL;
}