glx: NULL check the correct argument in dispatch_GLXVendorPriv

malloc can return NULL, unlike GetVendorDispatchFunc. The latter
provides DispatchBadRequest.

Signed-off-by: Emil Velikov <emil.velikov@collabora.com>
Reviewed-by: Adam Jackson <ajax@redhat.com>
This commit is contained in:
Emil Velikov 2018-02-19 15:18:08 +00:00 committed by Adam Jackson
parent 1310241e8d
commit 7fc7579869

View File

@ -387,12 +387,13 @@ static int dispatch_GLXVendorPriv(ClientPtr client)
// we'll still add an entry to the dispatch table, so that we don't
// have to look it up again later.
disp = (GlxVendorPrivDispatch *) malloc(sizeof(GlxVendorPrivDispatch));
if (disp == NULL) {
return BadAlloc;
}
disp->proc = GetVendorDispatchFunc(stuff->glxCode,
GlxCheckSwap(client,
stuff->vendorCode));
if (disp->proc == NULL) {
disp->proc = DispatchBadRequest;
}
}
return disp->proc(client);
}