intel: Don't dereference a NULL pointer of calloc fails
authorIan Romanick <ian.d.romanick@intel.com>
Tue, 16 Apr 2013 16:31:08 +0000 (09:31 -0700)
committerIan Romanick <ian.d.romanick@intel.com>
Wed, 17 Apr 2013 21:12:46 +0000 (14:12 -0700)
The caller of NewTextureObject does the right thing if NULL is returned,
so this function should do the right thing too.

NOTE: This is a candidate for stable branches.

Signed-off-by: Ian Romanick <ian.d.romanick@intel.com>
Reviewed-by: Kenneth Graunke <kenneth@whitecape.org>
src/mesa/drivers/dri/intel/intel_tex.c

index 1564f6cd97e02c2d60cb03de90664722d21233af..9bba9898b4766dd29390ce4bbf85abc321ca16e6 100644 (file)
@@ -35,6 +35,10 @@ intelNewTextureObject(struct gl_context * ctx, GLuint name, GLenum target)
    (void) ctx;
 
    DBG("%s\n", __FUNCTION__);
+
+   if (obj == NULL)
+      return NULL;
+
    _mesa_initialize_texture_object(&obj->base, name, target);
 
    obj->needs_validate = true;