radv: Do not close fd -1 when NULL-winsys creation fails.
authorBas Nieuwenhuizen <bas@basnieuwenhuizen.nl>
Sat, 23 May 2020 00:36:03 +0000 (02:36 +0200)
committerMarge Bot <eric+marge@anholt.net>
Mon, 25 May 2020 11:12:07 +0000 (11:12 +0000)
Fixes: cd6ec2b1abb "radv: implement a dummy winsys for creating devices without AMDGPU"
Reviewed-by: Samuel Pitoiset <samuel.pitoiset@gmail.com>
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/5181>

src/amd/vulkan/radv_device.c

index cf41a03b254841a9782089546d8afa0ab1c5f11e..dee5563e8243c8a80ec71a4460957cfde88d7afb 100644 (file)
@@ -443,7 +443,8 @@ fail_wsi:
 fail_alloc:
        vk_free(&instance->alloc, device);
 fail_fd:
-       close(fd);
+       if (fd != -1)
+               close(fd);
        if (master_fd != -1)
                close(master_fd);
        return result;