glx: Check malloc return value before accessing memory in glx/clientattrib.c
authorJuha-Pekka Heikkila <juhapekka.heikkila@gmail.com>
Mon, 2 Dec 2013 09:39:00 +0000 (02:39 -0700)
committerBrian Paul <brianp@vmware.com>
Tue, 3 Dec 2013 21:35:41 +0000 (14:35 -0700)
Signed-off-by: Juha-Pekka Heikkila <juhapekka.heikkila@gmail.com>
Reviewed-by: Brian Paul <brianp@vmware.com>
src/glx/clientattrib.c

index 1b306ea..37f14c5 100644 (file)
@@ -76,6 +76,10 @@ __indirect_glPushClientAttrib(GLuint mask)
    if (spp < &gc->attributes.stack[__GL_CLIENT_ATTRIB_STACK_DEPTH]) {
       if (!(sp = *spp)) {
          sp = malloc(sizeof(__GLXattribute));
+         if (sp == NULL) {
+            __glXSetError(gc, GL_OUT_OF_MEMORY);
+            return;
+         }
          *spp = sp;
       }
       sp->mask = mask;