mesa: check for allocation failures in _mesa_new_texture_object()
authorSamuel Pitoiset <samuel.pitoiset@gmail.com>
Wed, 21 Jun 2017 07:07:36 +0000 (09:07 +0200)
committerSamuel Pitoiset <samuel.pitoiset@gmail.com>
Thu, 22 Jun 2017 08:41:10 +0000 (10:41 +0200)
Signed-off-by: Samuel Pitoiset <samuel.pitoiset@gmail.com>
Reviewed-by: Timothy Arceri <tarceri@itsqueeze.com>
src/mesa/main/texobj.c

index 1877262ed65bf98abda1e68a3c625f15036c1e64..ed1eaf9b77b21c28381470e8f6b460fd9b4ee1bd 100644 (file)
@@ -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;
 }