From: Timothy Arceri Date: Wed, 26 Jul 2017 22:53:08 +0000 (+1000) Subject: mesa: check that buffer object is not NULL before initializing it X-Git-Url: https://git.libre-soc.org/?a=commitdiff_plain;h=2c34b49d9e2fe03376385199ef76915884ffd962;p=mesa.git mesa: check that buffer object is not NULL before initializing it Reviewed-by: Samuel Pitoiset --- 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; }