v3dv: fix leak

Cc: mesa-stable
Reviewed-by: Alejandro Piñeiro <apinheiro@igalia.com>
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/17201>
(cherry picked from commit 0bc65b1d81)
This commit is contained in:
Iago Toral Quiroga 2022-06-22 11:44:12 +02:00 committed by Dylan Baker
parent bc26f1c4ee
commit c2cbbefe49
2 changed files with 4 additions and 2 deletions

View file

@ -481,7 +481,7 @@
"description": "v3dv: fix leak",
"nominated": true,
"nomination_type": 0,
"resolution": 0,
"resolution": 1,
"main_sha": null,
"because_sha": null
},

View file

@ -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);