From c2cbbefe4992af7256657c32594c1728341ab46f Mon Sep 17 00:00:00 2001 From: Iago Toral Quiroga Date: Wed, 22 Jun 2022 11:44:12 +0200 Subject: [PATCH] v3dv: fix leak MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Cc: mesa-stable Reviewed-by: Alejandro PiƱeiro Part-of: (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);