diff options
author | Lionel Landwerlin <[email protected]> | 2019-10-18 15:28:30 +0300 |
---|---|---|
committer | Dylan Baker <[email protected]> | 2019-10-21 08:59:18 -0700 |
commit | cb0215a6fbe342bd0f479e712bf4b53c1c578c1d (patch) | |
tree | cffb1e62f5cf6b7156551baf4b81a007bc249d1b /src/intel/vulkan/anv_device.c | |
parent | 425fbe2902ba25df3e969d9410ae0c002f015235 (diff) |
anv: fix memory leak on device destroy
v2: handle vma destruction if vkCreateDevice fails (Jordan)
Signed-off-by: Lionel Landwerlin <[email protected]>
Gitlab: https://gitlab.freedesktop.org/mesa/mesa/issues/1959
Cc: <[email protected]>
Reviewed-by: Jordan Justen <[email protected]>
(cherry picked from commit b30e01aef5692be890f3f6ab944129b84d998254)
Diffstat (limited to 'src/intel/vulkan/anv_device.c')
-rw-r--r-- | src/intel/vulkan/anv_device.c | 12 |
1 files changed, 11 insertions, 1 deletions
diff --git a/src/intel/vulkan/anv_device.c b/src/intel/vulkan/anv_device.c index c88f5c4b7ff..510f0090ece 100644 --- a/src/intel/vulkan/anv_device.c +++ b/src/intel/vulkan/anv_device.c @@ -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); |