mirror of
https://gitlab.freedesktop.org/mesa/mesa.git
synced 2026-05-06 18:08:40 +02:00
anv: fix memory leak on device destroy
v2: handle vma destruction if vkCreateDevice fails (Jordan)
Signed-off-by: Lionel Landwerlin <lionel.g.landwerlin@intel.com>
Gitlab: https://gitlab.freedesktop.org/mesa/mesa/issues/1959
Cc: <mesa-stable@lists.freedesktop.org>
Reviewed-by: Jordan Justen <jordan.l.justen@intel.com>
(cherry picked from commit b30e01aef5)
This commit is contained in:
parent
425fbe2902
commit
cb0215a6fb
1 changed files with 11 additions and 1 deletions
|
|
@ -2421,7 +2421,7 @@ VkResult anv_CreateDevice(
|
|||
vk_priority_to_gen(priority));
|
||||
if (err != 0 && priority > VK_QUEUE_GLOBAL_PRIORITY_MEDIUM_EXT) {
|
||||
result = vk_error(VK_ERROR_NOT_PERMITTED_EXT);
|
||||
goto fail_fd;
|
||||
goto fail_vmas;
|
||||
}
|
||||
}
|
||||
|
||||
|
|
@ -2587,6 +2587,11 @@ VkResult anv_CreateDevice(
|
|||
pthread_mutex_destroy(&device->mutex);
|
||||
fail_context_id:
|
||||
anv_gem_destroy_context(device, device->context_id);
|
||||
fail_vmas:
|
||||
if (physical_device->use_softpin) {
|
||||
util_vma_heap_finish(&device->vma_hi);
|
||||
util_vma_heap_finish(&device->vma_lo);
|
||||
}
|
||||
fail_fd:
|
||||
close(device->fd);
|
||||
fail_device:
|
||||
|
|
@ -2642,6 +2647,11 @@ void anv_DestroyDevice(
|
|||
|
||||
anv_bo_pool_finish(&device->batch_bo_pool);
|
||||
|
||||
if (physical_device->use_softpin) {
|
||||
util_vma_heap_finish(&device->vma_hi);
|
||||
util_vma_heap_finish(&device->vma_lo);
|
||||
}
|
||||
|
||||
pthread_cond_destroy(&device->queue_submit);
|
||||
pthread_mutex_destroy(&device->mutex);
|
||||
|
||||
|
|
|
|||
Loading…
Add table
Reference in a new issue