[Mesa-dev] [PATCH 08/11] i965: Add extra null check in intel_bufferobj_alloc()

Juha-Pekka Heikkila juhapekka.heikkila at gmail.com
Mon Sep 8 23:53:47 PDT 2014


Check calloc returned requested memory.

Signed-off-by: Juha-Pekka Heikkila <juhapekka.heikkila at gmail.com>
---
 src/mesa/drivers/dri/i965/intel_buffer_objects.c | 3 +++
 1 file changed, 3 insertions(+)

diff --git a/src/mesa/drivers/dri/i965/intel_buffer_objects.c b/src/mesa/drivers/dri/i965/intel_buffer_objects.c
index 96dacde..0e19e46 100644
--- a/src/mesa/drivers/dri/i965/intel_buffer_objects.c
+++ b/src/mesa/drivers/dri/i965/intel_buffer_objects.c
@@ -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);
 
-- 
1.8.5.1



More information about the mesa-dev mailing list