[Mesa-dev] [PATCH] intel: Don't dereference a NULL pointer of calloc fails

Ian Romanick idr at freedesktop.org
Tue Apr 16 09:32:22 PDT 2013


From: Ian Romanick <ian.d.romanick at intel.com>

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 at intel.com>
---
 src/mesa/drivers/dri/intel/intel_tex.c | 4 ++++
 1 file changed, 4 insertions(+)

diff --git a/src/mesa/drivers/dri/intel/intel_tex.c b/src/mesa/drivers/dri/intel/intel_tex.c
index 1564f6c..9bba989 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;
-- 
1.8.1.4



More information about the mesa-dev mailing list