vulkan/wsi: Don't leak the FD when GetImageDrmFormatModifierProperties fails

Cc: mesa-stable@lists.freedesktop.org
Reviewed-by: Lionel Landwerlin <lionel.g.landwerlin@intel.com>
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/4135>
This commit is contained in:
Jason Ekstrand 2020-03-02 17:05:59 -06:00 committed by Marge Bot
parent 3c96e25de7
commit 34d2637fa7
1 changed files with 3 additions and 1 deletions

View File

@ -588,8 +588,10 @@ wsi_create_native_image(const struct wsi_swapchain *chain,
result = wsi->GetImageDrmFormatModifierPropertiesEXT(chain->device,
image->image,
&image_mod_props);
if (result != VK_SUCCESS)
if (result != VK_SUCCESS) {
close(fd);
goto fail;
}
image->drm_modifier = image_mod_props.drmFormatModifier;
assert(image->drm_modifier != DRM_FORMAT_MOD_INVALID);