summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorTimothy Arceri <tarceri@itsqueeze.com>2017-07-26 11:11:01 +1000
committerTimothy Arceri <tarceri@itsqueeze.com>2017-08-08 15:56:12 +1000
commitdae1e6ad1190107da3a75f57d48bd8292a47cbf2 (patch)
tree18eac4f81fd30bd18d639d064a8b9375cd92fad6
parentda10065d2b9b78fcb9446a4626343352cf30add0 (diff)
mesa: check default buffer object creation was successful
Reviewed-by: Samuel Pitoiset <samuel.pitoiset@gmail.com>
-rw-r--r--src/mesa/main/shared.c9
1 files changed, 9 insertions, 0 deletions
diff --git a/src/mesa/main/shared.c b/src/mesa/main/shared.c
index a2f0f8d398..53b8597d56 100644
--- a/src/mesa/main/shared.c
+++ b/src/mesa/main/shared.c
@@ -44,6 +44,9 @@
#include "util/hash_table.h"
#include "util/set.h"
+static void
+free_shared_state(struct gl_context *ctx, struct gl_shared_state *shared);
+
/**
* Allocate and initialize a shared context state structure.
* Initializes the display list, texture objects and vertex programs hash
@@ -90,6 +93,8 @@ _mesa_alloc_shared_state(struct gl_context *ctx)
/* Allocate the default buffer object */
shared->NullBufferObj = ctx->Driver.NewBufferObject(ctx, 0);
+ if (!shared->NullBufferObj)
+ goto fail;
/* Create default texture objects */
for (i = 0; i < NUM_TEXTURE_TARGETS; i++) {
@@ -132,6 +137,10 @@ _mesa_alloc_shared_state(struct gl_context *ctx)
shared->MemoryObjects = _mesa_NewHashTable();
return shared;
+
+fail:
+ free_shared_state(ctx, shared);
+ return NULL;
}