On 07/26/2017 03:11 AM, Timothy Arceri wrote:
---
  src/mesa/main/shared.c | 9 +++++++++
  1 file changed, 9 insertions(+)

diff --git a/src/mesa/main/shared.c b/src/mesa/main/shared.c
index 4bc93a7..27e8094 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 no_mem;

Maybe "goto fail" instead? Sounds like more common.

Series is:

Reviewed-by: Samuel Pitoiset <[email protected]>

/* Create default texture objects */
     for (i = 0; i < NUM_TEXTURE_TARGETS; i++) {
@@ -131,6 +136,10 @@ _mesa_alloc_shared_state(struct gl_context *ctx)
                                            _mesa_key_pointer_equal);
return shared;
+
+no_mem:
+   free_shared_state(ctx, shared);
+   return NULL;
  }
_______________________________________________
mesa-dev mailing list
[email protected]
https://lists.freedesktop.org/mailman/listinfo/mesa-dev

Reply via email to