From: Ian Romanick Date: Tue, 16 Apr 2013 16:31:08 +0000 (-0700) Subject: intel: Don't dereference a NULL pointer of calloc fails X-Git-Url: https://git.libre-soc.org/?a=commitdiff_plain;h=505ac6ddc6f83ee17655d54cf46ed71ead9e578c;p=mesa.git intel: Don't dereference a NULL pointer of calloc fails 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 Reviewed-by: Kenneth Graunke --- diff --git a/src/mesa/drivers/dri/intel/intel_tex.c b/src/mesa/drivers/dri/intel/intel_tex.c index 1564f6cd97e..9bba9898b47 100644 --- a/src/mesa/drivers/dri/intel/intel_tex.c +++ b/src/mesa/drivers/dri/intel/intel_tex.c @@ -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;