Mesa (master): glsl: Initialize coordinate to NULL in ir_texture constructor.

Kenneth Graunke kwg at kemper.freedesktop.org
Thu Jul 12 17:19:34 UTC 2012


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

Author: Kenneth Graunke <kenneth at whitecape.org>
Date:   Mon Jul  9 12:36:49 2012 -0700

glsl: Initialize coordinate to NULL in ir_texture constructor.

I ran into this while trying to create a TXS query, which doesn't have a
coordinate.  Since it didn't get initialized to NULL, a bunch of
visitors tried to access it and crashed.

Most of the time, this won't be a problem, but it's just a good idea.

Signed-off-by: Kenneth Graunke <kenneth at whitecape.org>
Reviewed-by: Eric Anholt <eric at anholt.net>

---

 src/glsl/ir.h |    3 ++-
 1 files changed, 2 insertions(+), 1 deletions(-)

diff --git a/src/glsl/ir.h b/src/glsl/ir.h
index b54e2f2..9bbf3b7 100644
--- a/src/glsl/ir.h
+++ b/src/glsl/ir.h
@@ -1341,7 +1341,8 @@ enum ir_texture_opcode {
 class ir_texture : public ir_rvalue {
 public:
    ir_texture(enum ir_texture_opcode op)
-      : op(op), projector(NULL), shadow_comparitor(NULL), offset(NULL)
+      : op(op), coordinate(NULL), projector(NULL), shadow_comparitor(NULL),
+        offset(NULL)
    {
       this->ir_type = ir_type_texture;
    }




More information about the mesa-commit mailing list