[Mesa-dev] [PATCH mesa] wsi/wayland: fix error path

Eric Engestrom eric at engestrom.ch
Wed Oct 19 23:09:11 UTC 2016


Fixes: 1720bbd353d87412754f ("anv/wsi: split image alloc/free out to separate fns.")
Cc: Dave Airlie <airlied at redhat.com>
Signed-off-by: Eric Engestrom <eric at engestrom.ch>
---

I'm not sure this is the right fix. The other thing I'm starting to lean
toward is to just remove these last two instruction (ie. everything after
`return VK_SUCCESS`).
Also, this is untested. It compiles, but that's it.

---
 src/vulkan/wsi/wsi_common_wayland.c | 4 ++++
 1 file changed, 4 insertions(+)

diff --git a/src/vulkan/wsi/wsi_common_wayland.c b/src/vulkan/wsi/wsi_common_wayland.c
index 32a0a51..fc13bde 100644
--- a/src/vulkan/wsi/wsi_common_wayland.c
+++ b/src/vulkan/wsi/wsi_common_wayland.c
@@ -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);
 
-- 
Cheers,
  Eric



More information about the mesa-dev mailing list