From 2c34b49d9e2fe03376385199ef76915884ffd962 Mon Sep 17 00:00:00 2001 From: Timothy Arceri Date: Thu, 27 Jul 2017 08:53:08 +1000 Subject: mesa: check that buffer object is not NULL before initializing it Reviewed-by: Samuel Pitoiset --- src/mesa/main/bufferobj.c | 7 +++---- 1 file changed, 3 insertions(+), 4 deletions(-) diff --git a/src/mesa/main/bufferobj.c b/src/mesa/main/bufferobj.c index cb666dcf13f..cd561a0a271 100644 --- a/src/mesa/main/bufferobj.c +++ b/src/mesa/main/bufferobj.c @@ -443,11 +443,10 @@ convert_clear_buffer_data(struct gl_context *ctx, static struct gl_buffer_object * _mesa_new_buffer_object(struct gl_context *ctx, GLuint name) { - struct gl_buffer_object *obj; - - (void) ctx; + struct gl_buffer_object *obj = MALLOC_STRUCT(gl_buffer_object); + if (!obj) + return NULL; - obj = MALLOC_STRUCT(gl_buffer_object); _mesa_initialize_buffer_object(ctx, obj, name); return obj; } -- cgit v1.2.3