diff options
author | Emil Velikov <emil.velikov@collabora.com> | 2018-02-19 15:18:08 +0000 |
---|---|---|
committer | Adam Jackson <ajax@redhat.com> | 2018-02-21 11:07:08 -0500 |
commit | 7fc757986947ad89d76fc0fd3d69f5fdeefc9055 (patch) | |
tree | fd9b1b0d48c8fba1248180143ba2aed6cb8e596a | |
parent | 1310241e8d606687811c7394811fe337c3e4de11 (diff) |
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>
-rw-r--r-- | glx/vndcmds.c | 7 |
1 files changed, 4 insertions, 3 deletions
diff --git a/glx/vndcmds.c b/glx/vndcmds.c index 200176d4c..c3e1332bf 100644 --- a/glx/vndcmds.c +++ b/glx/vndcmds.c @@ -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); } |