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 1b306eab120a4fd50f3138c4e41a97192a575320..37f14c541a5e81ce196b336acbbec8b759cba563 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;