anv: Clean up anv_semaphore::base on the error path

Fixes: 682c81bdfb "vulkan,anv: Add a base object struct type"
Reviewed-by: Lionel Landwerlin <lionel.g.landwerlin@intel.com>
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/10123>
(cherry picked from commit 2b19b7a165)
This commit is contained in:
Jason Ekstrand 2021-04-08 16:40:45 -05:00 committed by Dylan Baker
parent 687e56af76
commit f35cdf8f56
2 changed files with 5 additions and 1 deletions

View file

@ -1948,7 +1948,7 @@
"description": "anv: Clean up anv_semaphore::base on the error path",
"nominated": true,
"nomination_type": 1,
"resolution": 0,
"resolution": 1,
"master_sha": null,
"because_sha": "682c81bdfb7ea28efccea1e8cbfeb7cfc67d02b8"
},

View file

@ -2134,6 +2134,7 @@ VkResult anv_CreateSemaphore(
else
result = timeline_semaphore_create(device, &semaphore->permanent, timeline_value);
if (result != VK_SUCCESS) {
vk_object_base_finish(&semaphore->base);
vk_free2(&device->vk.alloc, pAllocator, semaphore);
return result;
}
@ -2144,6 +2145,7 @@ VkResult anv_CreateSemaphore(
else
result = timeline_semaphore_create(device, &semaphore->permanent, timeline_value);
if (result != VK_SUCCESS) {
vk_object_base_finish(&semaphore->base);
vk_free2(&device->vk.alloc, pAllocator, semaphore);
return result;
}
@ -2154,6 +2156,7 @@ VkResult anv_CreateSemaphore(
semaphore->permanent.type = ANV_SEMAPHORE_TYPE_DRM_SYNCOBJ;
semaphore->permanent.syncobj = anv_gem_syncobj_create(device, 0);
if (!semaphore->permanent.syncobj) {
vk_object_base_finish(&semaphore->base);
vk_free2(&device->vk.alloc, pAllocator, semaphore);
return vk_error(VK_ERROR_OUT_OF_HOST_MEMORY);
}
@ -2163,6 +2166,7 @@ VkResult anv_CreateSemaphore(
}
} else {
assert(!"Unknown handle type");
vk_object_base_finish(&semaphore->base);
vk_free2(&device->vk.alloc, pAllocator, semaphore);
return vk_error(VK_ERROR_INVALID_EXTERNAL_HANDLE);
}