Mesa (master): mesa: check that buffer object is not NULL before initializing it

Timothy Arceri tarceri at kemper.freedesktop.org
Thu Jul 27 12:20:04 UTC 2017


Module: Mesa
Branch: master
Commit: 2c34b49d9e2fe03376385199ef76915884ffd962
URL:    http://cgit.freedesktop.org/mesa/mesa/commit/?id=2c34b49d9e2fe03376385199ef76915884ffd962

Author: Timothy Arceri <tarceri at itsqueeze.com>
Date:   Thu Jul 27 08:53:08 2017 +1000

mesa: check that buffer object is not NULL before initializing it

Reviewed-by: Samuel Pitoiset <samuel.pitoiset at gmail.com>

---

 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 cb666dcf13..cd561a0a27 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;
 }




More information about the mesa-commit mailing list