Mesa (master): mesa: check for allocation failures in _mesa_new_texture_object()

Samuel Pitoiset hakzsam at kemper.freedesktop.org
Thu Jun 22 08:46:18 UTC 2017


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

Author: Samuel Pitoiset <samuel.pitoiset at gmail.com>
Date:   Wed Jun 21 09:07:36 2017 +0200

mesa: check for allocation failures in _mesa_new_texture_object()

Signed-off-by: Samuel Pitoiset <samuel.pitoiset at gmail.com>
Reviewed-by: Timothy Arceri <tarceri at itsqueeze.com>

---

 src/mesa/main/texobj.c | 7 +++++--
 1 file changed, 5 insertions(+), 2 deletions(-)

diff --git a/src/mesa/main/texobj.c b/src/mesa/main/texobj.c
index 1877262ed6..ed1eaf9b77 100644
--- a/src/mesa/main/texobj.c
+++ b/src/mesa/main/texobj.c
@@ -234,11 +234,14 @@ _mesa_get_current_tex_object(struct gl_context *ctx, GLenum target)
  * \return pointer to new texture object.
  */
 struct gl_texture_object *
-_mesa_new_texture_object( struct gl_context *ctx, GLuint name, GLenum target )
+_mesa_new_texture_object(struct gl_context *ctx, GLuint name, GLenum target)
 {
    struct gl_texture_object *obj;
-   (void) ctx;
+
    obj = MALLOC_STRUCT(gl_texture_object);
+   if (!obj)
+      return NULL;
+
    _mesa_initialize_texture_object(ctx, obj, name, target);
    return obj;
 }




More information about the mesa-commit mailing list