[Mesa-dev] [PATCH 14/15] mesa/drivers: Add extra null check in blitframebuffer_texture()

Juha-Pekka Heikkila juhapekka.heikkila at gmail.com
Sun Apr 27 13:05:09 PDT 2014


If texObj == NULL here it mean there is already GL_INVALID_VALUE
or GL_OUT_OF_MEMORY error set to context.

Signed-off-by: Juha-Pekka Heikkila <juhapekka.heikkila at gmail.com>
---
 src/mesa/drivers/common/meta_blit.c | 7 +++++++
 1 file changed, 7 insertions(+)

diff --git a/src/mesa/drivers/common/meta_blit.c b/src/mesa/drivers/common/meta_blit.c
index 5d72dd2..9c20430 100644
--- a/src/mesa/drivers/common/meta_blit.c
+++ b/src/mesa/drivers/common/meta_blit.c
@@ -418,6 +418,10 @@ blitframebuffer_texture(struct gl_context *ctx,
       _mesa_BindTexture(target, tempTex);
       srcLevel = 0;
       texObj = _mesa_lookup_texture(ctx, tempTex);
+      if (texObj == NULL) {
+         return false;
+      }
+
       texImage = _mesa_get_tex_image(ctx, texObj, target, srcLevel);
 
       if (!ctx->Driver.BindRenderbufferTexImage(ctx, rb, texImage)) {
@@ -462,6 +466,9 @@ blitframebuffer_texture(struct gl_context *ctx,
       srcLevel = 0;
       target = meta_temp_texture->Target;
       texObj = _mesa_lookup_texture(ctx, meta_temp_texture->TexObj);
+      if (texObj == NULL) {
+         return false;
+      }
 
       _mesa_meta_setup_copypix_texture(ctx, meta_temp_texture,
                                        srcX0, srcY0,
-- 
1.8.1.2



More information about the mesa-dev mailing list