Mesa (master): anv: fix unwind of vkCreateDevice fail

GitLab Mirror gitlab-mirror at kemper.freedesktop.org
Tue Oct 22 20:44:42 UTC 2019


Module: Mesa
Branch: master
Commit: 0dfa643feb6e80f654fdc4efc71c22e751a53de3
URL:    http://cgit.freedesktop.org/mesa/mesa/commit/?id=0dfa643feb6e80f654fdc4efc71c22e751a53de3

Author: Lionel Landwerlin <lionel.g.landwerlin at intel.com>
Date:   Tue Oct 22 15:34:12 2019 +0300

anv: fix unwind of vkCreateDevice fail

We're skipping the context destruction in some cases which is the
grand scheme of thing is not that important because closing device->fd
will destroy the associated context as well.

Signed-off-by: Lionel Landwerlin <lionel.g.landwerlin at intel.com>
Reported-by: Jordan Justen <jordan.l.justen at intel.com>
Reviewed-by: Jordan Justen <jordan.l.justen at intel.com>
Cc: <mesa-stable at lists.freedesktop.org>
Fixes: b30e01aef56 ("anv: fix memory leak on device destroy")

---

 src/intel/vulkan/anv_device.c | 6 +++---
 1 file changed, 3 insertions(+), 3 deletions(-)

diff --git a/src/intel/vulkan/anv_device.c b/src/intel/vulkan/anv_device.c
index 6d94cfc66ba..8934957e39b 100644
--- a/src/intel/vulkan/anv_device.c
+++ b/src/intel/vulkan/anv_device.c
@@ -2486,7 +2486,7 @@ VkResult anv_CreateDevice(
    if (physical_device->use_softpin) {
       if (pthread_mutex_init(&device->vma_mutex, NULL) != 0) {
          result = vk_error(VK_ERROR_INITIALIZATION_FAILED);
-         goto fail_fd;
+         goto fail_context_id;
       }
 
       /* keep the page with address zero out of the allocator */
@@ -2682,13 +2682,13 @@ VkResult anv_CreateDevice(
    pthread_cond_destroy(&device->queue_submit);
  fail_mutex:
    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_context_id:
+   anv_gem_destroy_context(device, device->context_id);
  fail_fd:
    close(device->fd);
  fail_device:




More information about the mesa-commit mailing list