vulkan/wsi/x11: Better handle wsi_x11_connection_create failure
authorJason Ekstrand <jason.ekstrand@intel.com>
Wed, 2 Nov 2016 00:16:14 +0000 (17:16 -0700)
committerJason Ekstrand <jason.ekstrand@intel.com>
Wed, 2 Nov 2016 16:25:57 +0000 (09:25 -0700)
Without this fix, the function would still end up returning NULL but it
would put that NULL connection in the hash table which would be bad.

Signed-off-by: Jason Ekstrand <jason@jlekstrand.net>
Reviewed-by: Dave Airlie <airlied@redhat.com>
Reviewed-by: Eric Engestrom <eric.engestrom@imgtec.com>
Cc: "13.0" <mesa-stable@lists.freedesktop.org>
src/vulkan/wsi/wsi_common_x11.c

index 814284799f61a5aeaf032f925bb3fb58c11b4936..eee2359d03a1dc90b4c6e8eedb02f0cdb01a38e5 100644 (file)
@@ -118,6 +118,8 @@ wsi_x11_get_connection(struct wsi_device *wsi_dev,
 
       struct wsi_x11_connection *wsi_conn =
          wsi_x11_connection_create(alloc, conn);
+      if (!wsi_conn)
+         return NULL;
 
       pthread_mutex_lock(&wsi->mutex);