vulkan/wsi: fix cleanup when dup() fails
authorEric Engestrom <eric@engestrom.ch>
Tue, 10 Mar 2020 17:54:41 +0000 (18:54 +0100)
committerMarge Bot <eric+marge@anholt.net>
Tue, 10 Mar 2020 22:43:25 +0000 (22:43 +0000)
Fixes: f5433e4d6ce247b86dae ("vulkan/wsi: Add modifiers support to wsi_create_native_image")
Signed-off-by: Eric Engestrom <eric@engestrom.ch>
Reviewed-by: Jason Ekstrand <jason@jlekstrand.net>
Tested-by: Marge Bot <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/4137>
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/4137>

src/vulkan/wsi/wsi_common.c

index 8d6654cb47d0e3cac08e570e1bf5870a22d34751..d629ea339ac36956e9e7237962d0194d3e049793 100644 (file)
@@ -620,7 +620,7 @@ wsi_create_native_image(const struct wsi_swapchain *chain,
             image->fds[p] = dup(fd);
             if (image->fds[p] == -1) {
                for (uint32_t i = 0; i < p; i++)
-                  close(image->fds[p]);
+                  close(image->fds[i]);
 
                result = VK_ERROR_OUT_OF_HOST_MEMORY;
                goto fail;