summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorTimothy Arceri <[email protected]>2017-07-27 08:53:08 +1000
committerTimothy Arceri <[email protected]>2017-07-27 22:19:52 +1000
commit2c34b49d9e2fe03376385199ef76915884ffd962 (patch)
tree63a847397fba2a98a243d16be332d0d7d203ddbd
parent6ee3323d7db26720b60a7a7fbd0fe669e86e4dc2 (diff)
mesa: check that buffer object is not NULL before initializing it
Reviewed-by: Samuel Pitoiset <[email protected]>
-rw-r--r--src/mesa/main/bufferobj.c7
1 files 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;
}