v3dv: do not access member of a NULL structure

Check if the structure is NULL before trying to get access to its
members.

This has been detected by the Undefined Behaviour Sanitizer (UBSan).

Reviewed-by: Iago Toral Quiroga <itoral@igalia.com>
Signed-off-by: Juan A. Suarez Romero <jasuarez@igalia.com>
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/29911>
This commit is contained in:
Juan A. Suarez Romero
2024-06-26 10:11:26 +02:00
committed by Marge Bot
parent 7dc6b8df11
commit 1d71be8e60

View File

@@ -1655,7 +1655,7 @@ v3dv_GetInstanceProcAddr(VkInstance _instance,
const char *pName)
{
V3DV_FROM_HANDLE(v3dv_instance, instance, _instance);
return vk_instance_get_proc_addr(&instance->vk,
return vk_instance_get_proc_addr(instance ? &instance->vk : NULL,
&v3dv_instance_entrypoints,
pName);
}