i965: Add extra null check in intel_bufferobj_alloc()
authorJuha-Pekka Heikkila <juhapekka.heikkila@gmail.com>
Fri, 1 Aug 2014 11:38:17 +0000 (14:38 +0300)
committerTapani Pälli <tapani.palli@intel.com>
Tue, 23 Sep 2014 07:25:02 +0000 (10:25 +0300)
Check calloc returned requested memory.

Signed-off-by: Juha-Pekka Heikkila <juhapekka.heikkila@gmail.com>
Reviewed-by: Anuj Phogat <anuj.phogat@gmail.com>
src/mesa/drivers/dri/i965/intel_buffer_objects.c

index 96dacde04fba60e800e7680f40e225bb725cf9c1..0e19e465c4cabdf2f0de1958387e319578ee7610 100644 (file)
@@ -136,6 +136,9 @@ static struct gl_buffer_object *
 intel_bufferobj_alloc(struct gl_context * ctx, GLuint name, GLenum target)
 {
    struct intel_buffer_object *obj = CALLOC_STRUCT(intel_buffer_object);
+   if (!obj) {
+      _mesa_error_no_memory(__func__);
+   }
 
    _mesa_initialize_buffer_object(ctx, &obj->Base, name, target);