wsi/wayland: fix error path
authorEric Engestrom <eric@engestrom.ch>
Wed, 19 Oct 2016 23:09:11 +0000 (00:09 +0100)
committerDave Airlie <airlied@redhat.com>
Thu, 20 Oct 2016 00:53:59 +0000 (10:53 +1000)
Fixes: 1720bbd353d87412754f ("anv/wsi: split image alloc/free out to separate fns.")
Cc: "13.0" <mesa-stable@lists.freedesktop.org>
Signed-off-by: Eric Engestrom <eric@engestrom.ch>
Signed-off-by: Dave Airlie <airlied@redhat.com>
src/vulkan/wsi/wsi_common_wayland.c

index 32a0a51349d60193aa7ea8d8df3fb1dec302ca08..fc13bde4005896b70f9c2ab513c2d1cf01daa1ce 100644 (file)
@@ -635,11 +635,15 @@ wsi_wl_image_init(struct wsi_wl_swapchain *chain,
    wl_display_roundtrip(chain->display->display);
    close(fd);
 
+   if (!image->buffer)
+      goto fail_image;
+
    wl_proxy_set_queue((struct wl_proxy *)image->buffer, chain->queue);
    wl_buffer_add_listener(image->buffer, &buffer_listener, image);
 
    return VK_SUCCESS;
 
+fail_image:
    chain->base.image_fns->free_wsi_image(vk_device, pAllocator,
                                          image->image, image->memory);