summaryrefslogtreecommitdiff
path: root/src/glsl/ir.cpp
diff options
context:
space:
mode:
authorEric Anholt <eric@anholt.net>2010-07-20 17:17:47 -0700
committerEric Anholt <eric@anholt.net>2010-07-20 17:30:10 -0700
commitfade78edcbff1e0ae24a1e2c455be2cc7932ee9c (patch)
treebc2aea7eab6208e6e666f19d48707c3313c57077 /src/glsl/ir.cpp
parent21b0dbd79937e9d6787f045af7d60d4b6c649ec8 (diff)
glsl2: strdup the field names used in dereference_record.
Otherwise, after linking and freeing the old data, the pointer would dangle. Partial fix for glsl1-struct*.
Diffstat (limited to 'src/glsl/ir.cpp')
-rw-r--r--src/glsl/ir.cpp4
1 files changed, 2 insertions, 2 deletions
diff --git a/src/glsl/ir.cpp b/src/glsl/ir.cpp
index 1648848ecb..ba8ee7b9ac 100644
--- a/src/glsl/ir.cpp
+++ b/src/glsl/ir.cpp
@@ -514,7 +514,7 @@ ir_dereference_record::ir_dereference_record(ir_rvalue *value,
{
this->ir_type = ir_type_dereference_record;
this->record = value;
- this->field = field;
+ this->field = talloc_strdup(this, field);
this->type = (this->record != NULL)
? this->record->type->field_type(field) : glsl_type::error_type;
}
@@ -527,7 +527,7 @@ ir_dereference_record::ir_dereference_record(ir_variable *var,
this->ir_type = ir_type_dereference_record;
this->record = new(ctx) ir_dereference_variable(var);
- this->field = field;
+ this->field = talloc_strdup(this, field);
this->type = (this->record != NULL)
? this->record->type->field_type(field) : glsl_type::error_type;
}