radv: Fix memory leak on error path.

Fix defects reported by Coverity Scan.

Resource leak (RESOURCE_LEAK)
leaked_storage: Variable signal_semaphore_infos going out of scope leaks the storage it points to
leaked_storage: Variable wait_semaphore_infos going out of scope leaks the storage it points to.

Fixes: 3da7d10d9b ("radv: implement vkQueueSubmit2KHR()")
Signed-off-by: Vinson Lee <vlee@freedesktop.org>
Reviewed-by: Daniel Schürmann <daniel@schuermann.dev>
Reviewed-by: Samuel Pitoiset <samuel.pitoiset@gmail.com>
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/14260>
This commit is contained in:
Vinson Lee 2021-12-19 19:10:21 -08:00
parent d2148af2ca
commit 222487fabe
1 changed files with 4 additions and 1 deletions

View File

@ -5747,8 +5747,11 @@ radv_QueueBindSparse(VkQueue _queue, uint32_t bindInfoCount, const VkBindSparseI
VkSemaphoreSubmitInfoKHR *signal_semaphore_infos =
malloc(sizeof(*signal_semaphore_infos) * pBindInfo[i].signalSemaphoreCount);
if (!wait_semaphore_infos || !signal_semaphore_infos)
if (!wait_semaphore_infos || !signal_semaphore_infos) {
free(wait_semaphore_infos);
free(signal_semaphore_infos);
return VK_ERROR_OUT_OF_HOST_MEMORY;
}
for (uint32_t j = 0; j < pBindInfo[i].waitSemaphoreCount; j++) {
wait_semaphore_infos[j] = (VkSemaphoreSubmitInfoKHR) {