vulkan/wsi: fix cleanup when dup() fails

Fixes: f5433e4d6c ("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>
This commit is contained in:
Eric Engestrom 2020-03-10 18:54:41 +01:00 committed by Marge Bot
parent 6e035c01fb
commit 1fa259b035

View 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;