Mesa (staging/19.3): anv: Fix a potential BO handle leak
GitLab Mirror
gitlab-mirror at kemper.freedesktop.org
Thu Oct 31 22:15:30 UTC 2019
Module: Mesa
Branch: staging/19.3
Commit: 5f8e0c715ef7d7ef5ae05696cfa7669273bb179d
URL: http://cgit.freedesktop.org/mesa/mesa/commit/?id=5f8e0c715ef7d7ef5ae05696cfa7669273bb179d
Author: Jason Ekstrand <jason at jlekstrand.net>
Date: Fri Oct 25 15:42:22 2019 -0500
anv: Fix a potential BO handle leak
Fixes: 731c4adcf9b "anv/allocator: Add support for non-userptr"
Reviewed-by: Lionel Landwerlin <lionel.g.landwerlin at intel.com>
(cherry picked from commit bb257e1852473e3bc49bb9e0fe014741894f7bd0)
---
src/intel/vulkan/anv_allocator.c | 4 +++-
1 file changed, 3 insertions(+), 1 deletion(-)
diff --git a/src/intel/vulkan/anv_allocator.c b/src/intel/vulkan/anv_allocator.c
index 1f5495d56b2..fd3818ff9aa 100644
--- a/src/intel/vulkan/anv_allocator.c
+++ b/src/intel/vulkan/anv_allocator.c
@@ -532,9 +532,11 @@ anv_block_pool_expand_range(struct anv_block_pool *pool,
if (use_softpin) {
gem_handle = anv_gem_create(pool->device, newbo_size);
map = anv_gem_mmap(pool->device, gem_handle, 0, newbo_size, 0);
- if (map == MAP_FAILED)
+ if (map == MAP_FAILED) {
+ anv_gem_close(pool->device, gem_handle);
return vk_errorf(pool->device->instance, pool->device,
VK_ERROR_MEMORY_MAP_FAILED, "gem mmap failed: %m");
+ }
assert(center_bo_offset == 0);
} else {
/* Just leak the old map until we destroy the pool. We can't munmap it
More information about the mesa-commit
mailing list