From: Emil Velikov <emil.veli...@collabora.com>

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

Signed-off-by: Emil Velikov <emil.veli...@collabora.com>
---
 glx/vndcmds.c | 7 ++++---
 1 file 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);
 }
-- 
2.16.0

_______________________________________________
xorg-devel@lists.x.org: X.Org development
Archives: http://lists.x.org/archives/xorg-devel
Info: https://lists.x.org/mailman/listinfo/xorg-devel

Reply via email to