[Mesa-dev] [PATCH 2/3] mesa/main: Missing NULL pointer check.

Plamena Manolova plamena.manolova at intel.com
Wed Jun 14 16:33:13 UTC 2017


In prepare_target it's plausible that the parameters of
_mesa_lookup_texture might be invalid and NULL is returned,
so we need a NULL pointer check.

CID: 1412566
Signed-off-by: Plamena Manolova <plamena.manolova at intel.com>
---
 src/mesa/main/copyimage.c | 7 +++++--
 1 file changed, 5 insertions(+), 2 deletions(-)

diff --git a/src/mesa/main/copyimage.c b/src/mesa/main/copyimage.c
index 2cb617c..dd97f1a 100644
--- a/src/mesa/main/copyimage.c
+++ b/src/mesa/main/copyimage.c
@@ -228,14 +228,17 @@ prepare_target(struct gl_context *ctx, GLuint name, GLenum target,
    } else {
       struct gl_texture_object *texObj = _mesa_lookup_texture(ctx, name);
 
+      *renderbuffer = NULL;
+
+      if (texObj == NULL)
+        return;
+
       if (target == GL_TEXTURE_CUBE_MAP) {
          *texImage = texObj->Image[z][level];
       }
       else {
          *texImage = _mesa_select_tex_image(texObj, target, level);
       }
-
-      *renderbuffer = NULL;
    }
 }
 
-- 
2.9.3



More information about the mesa-dev mailing list