main: fix coverity error in _mesa_program_resource_find_name()

We did not take into account if name is NULL, so we could dereference
a NULL pointer in strncmp() call.
Signed-off-by: Samuel Iglesias Gonsálvez's avatarSamuel Iglesias Gonsálvez <siglesias@igalia.com>
Reviewed-by: Tapani Pälli's avatarTapani Pälli <tapani.palli@intel.com>
parent f2f12776
Pipeline #95728 passed with stages
in 14 minutes and 27 seconds
......@@ -581,8 +581,11 @@ _mesa_program_resource_find_name(struct gl_shader_program *shProg,
{
struct gl_program_resource *res = NULL;
if (name == NULL)
return NULL;
/* If we have a name, try the ProgramResourceHash first. */
if (name && shProg->data->ProgramResourceHash)
if (shProg->data->ProgramResourceHash)
res = search_resource_hash(shProg, programInterface, name, array_index);
if (res)
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment