hk: fix instance reference in vk_free

In hk_create_drm_physical_device() we might call vk_free() passing
pdev->vk.instance->alloc as first argument, but if we've arrived there
via fail_pdev_alloc the instance has not yet been installed into the
physical device, potentially triggering a SIGSEGV.

Fix it by using a direct reference to the instance as first argument.

Signed-off-by: Sergio Lopez <slp@redhat.com>
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/37642>
This commit is contained in:
Sergio Lopez 2025-09-30 15:54:26 +00:00
parent f5dd8436b2
commit 2732837591

View file

@ -1297,7 +1297,7 @@ fail_pdev_alloc:
if (pdev->master_fd)
close(pdev->master_fd);
vk_free(&pdev->vk.instance->alloc, pdev);
vk_free(&instance->vk.alloc, pdev);
fail_fd:
close(fd);
return result;