summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
-rw-r--r--src/compiler/glsl/loop_controls.cpp5
1 files changed, 3 insertions, 2 deletions
diff --git a/src/compiler/glsl/loop_controls.cpp b/src/compiler/glsl/loop_controls.cpp
index c717605ec74..fa739afa24e 100644
--- a/src/compiler/glsl/loop_controls.cpp
+++ b/src/compiler/glsl/loop_controls.cpp
@@ -97,9 +97,10 @@ calculate_iterations(ir_rvalue *from, ir_rvalue *to, ir_rvalue *increment,
new(mem_ctx) ir_expression(ir_binop_div, sub->type, sub, increment);
ir_constant *iter = div->constant_expression_value();
-
- if (iter == NULL)
+ if (iter == NULL) {
+ ralloc_free(mem_ctx);
return -1;
+ }
if (!iter->type->is_integer()) {
const ir_expression_operation op = iter->type->is_double()