Module: Mesa
Branch: staging/20.0
Commit: 7daa262486aa266e039e344f8ff66177714fcfb7
URL:    
http://cgit.freedesktop.org/mesa/mesa/commit/?id=7daa262486aa266e039e344f8ff66177714fcfb7

Author: Jason Ekstrand <ja...@jlekstrand.net>
Date:   Mon Mar  2 17:05:59 2020 -0600

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

Cc: mesa-sta...@lists.freedesktop.org
Reviewed-by: Lionel Landwerlin <lionel.g.landwer...@intel.com>
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/4135>
(cherry picked from commit 34d2637fa76ba4dd1969f06352e191ccb228d8f3)

---

 .pick_status.json           | 2 +-
 src/vulkan/wsi/wsi_common.c | 4 +++-
 2 files changed, 4 insertions(+), 2 deletions(-)

diff --git a/.pick_status.json b/.pick_status.json
index c8944a35687..50c7863d733 100644
--- a/.pick_status.json
+++ b/.pick_status.json
@@ -31,7 +31,7 @@
         "description": "vulkan/wsi: Don't leak the FD when 
GetImageDrmFormatModifierProperties fails",
         "nominated": true,
         "nomination_type": 0,
-        "resolution": 0,
+        "resolution": 1,
         "master_sha": null,
         "because_sha": null
     },
diff --git a/src/vulkan/wsi/wsi_common.c b/src/vulkan/wsi/wsi_common.c
index 0adf54eab8f..c278d5d1347 100644
--- a/src/vulkan/wsi/wsi_common.c
+++ b/src/vulkan/wsi/wsi_common.c
@@ -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);
 

_______________________________________________
mesa-commit mailing list
mesa-commit@lists.freedesktop.org
https://lists.freedesktop.org/mailman/listinfo/mesa-commit

Reply via email to