diff options
author | Lionel Landwerlin <[email protected]> | 2019-05-08 11:39:09 +0100 |
---|---|---|
committer | Lionel Landwerlin <[email protected]> | 2019-05-08 12:02:13 +0100 |
commit | 43596e5f343e6f6dc9a81e36701324f79390cff3 (patch) | |
tree | f3063fca938c4a65681fcaec6af02a9568b5586e /src | |
parent | a07d06f10352fc5fa40db8a723fa5842ebc660db (diff) |
anv: fix use after free
Once mem->bo is removed from the cache, it is likely to be freed.
Signed-off-by: Lionel Landwerlin <[email protected]>
Fixes: b80930a6fea075 ("anv: add support for VK_EXT_memory_budget")
Reviewed-by: Eric Engestrom <[email protected]>
Diffstat (limited to 'src')
-rw-r--r-- | src/intel/vulkan/anv_device.c | 6 |
1 files changed, 3 insertions, 3 deletions
diff --git a/src/intel/vulkan/anv_device.c b/src/intel/vulkan/anv_device.c index d74116bd9c9..e9f90604924 100644 --- a/src/intel/vulkan/anv_device.c +++ b/src/intel/vulkan/anv_device.c @@ -2995,6 +2995,9 @@ void anv_FreeMemory( if (mem->map) anv_UnmapMemory(_device, _mem); + p_atomic_add(&pdevice->memory.heaps[mem->type->heapIndex].used, + -mem->bo->size); + anv_bo_cache_release(device, &device->bo_cache, mem->bo); #if defined(ANDROID) && ANDROID_API_LEVEL >= 26 @@ -3002,9 +3005,6 @@ void anv_FreeMemory( AHardwareBuffer_release(mem->ahw); #endif - p_atomic_add(&pdevice->memory.heaps[mem->type->heapIndex].used, - -mem->bo->size); - vk_free2(&device->alloc, pAllocator, mem); } |