Mesa (staging/22.1): v3dv: fix leak

GitLab Mirror gitlab-mirror at kemper.freedesktop.org
Tue Jun 28 22:55:14 UTC 2022


Module: Mesa
Branch: staging/22.1
Commit: c2cbbefe4992af7256657c32594c1728341ab46f
URL:    http://cgit.freedesktop.org/mesa/mesa/commit/?id=c2cbbefe4992af7256657c32594c1728341ab46f

Author: Iago Toral Quiroga <itoral at igalia.com>
Date:   Wed Jun 22 11:44:12 2022 +0200

v3dv: fix leak

Cc: mesa-stable
Reviewed-by: Alejandro Piñeiro <apinheiro at igalia.com>
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/17201>
(cherry picked from commit 0bc65b1d81f1064a1ef14a6afbeab2dc46e2329b)

---

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

diff --git a/.pick_status.json b/.pick_status.json
index 1c47049335e..f4b6a8144b0 100644
--- a/.pick_status.json
+++ b/.pick_status.json
@@ -481,7 +481,7 @@
         "description": "v3dv: fix leak",
         "nominated": true,
         "nomination_type": 0,
-        "resolution": 0,
+        "resolution": 1,
         "main_sha": null,
         "because_sha": null
     },
diff --git a/src/broadcom/vulkan/v3dv_device.c b/src/broadcom/vulkan/v3dv_device.c
index 02392bf546f..271ef702b6f 100644
--- a/src/broadcom/vulkan/v3dv_device.c
+++ b/src/broadcom/vulkan/v3dv_device.c
@@ -2488,8 +2488,10 @@ v3dv_CreateBuffer(VkDevice  _device,
 
    /* Limit allocations to 32-bit */
    const VkDeviceSize aligned_size = align64(buffer->size, buffer->alignment);
-   if (aligned_size > UINT32_MAX || aligned_size < buffer->size)
+   if (aligned_size > UINT32_MAX || aligned_size < buffer->size) {
+      vk_free(&device->vk.alloc, buffer);
       return VK_ERROR_OUT_OF_DEVICE_MEMORY;
+   }
 
    *pBuffer = v3dv_buffer_to_handle(buffer);
 



More information about the mesa-commit mailing list