vulkan/device_select: avoid segfault on Wayland if wl_drm is unavailable
On Wayland, if the wl_drm interface is not available, for example if the compositor is using the proprietary NVIDIA driver along with their egl-wayland library, the device_select layer will fail to initialize. However, the failure path will unconditionally call wl_drm_destroy even though info.wl_drm would be NULL in that case. This can cause a segfault in libwayland-client.so. To fix this, check if info.wl_drm is NULL before calling wl_drm_destroy. This way, initialization will fail gracefully even if that interface is not present. Signed-off-by: Erik Kurzinger <ekurzinger@nvidia.com> Reviewed-by: Lionel Landwerlin <lionel.g.landwerlin@intel.com> Reviewed-by: Eric Engestrom <eric@engestrom.ch> Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/10598>
This commit is contained in:
parent
dd48683cfd
commit
f4eb13dc55
|
@ -139,7 +139,8 @@ int device_select_find_wayland_pci_default(struct device_pci_info *devices, uint
|
|||
}
|
||||
}
|
||||
|
||||
wl_drm_destroy(info.wl_drm);
|
||||
if (info.wl_drm)
|
||||
wl_drm_destroy(info.wl_drm);
|
||||
wl_registry_destroy(registry);
|
||||
wl_display_disconnect(display);
|
||||
out:
|
||||
|
|
Loading…
Reference in New Issue