summaryrefslogtreecommitdiffstats
path: root/src/compiler/glsl
diff options
context:
space:
mode:
authorTimothy Arceri <[email protected]>2017-03-17 21:53:35 +1100
committerTimothy Arceri <[email protected]>2017-03-18 14:12:40 +1100
commit40bc1afc9437433f2f1d1c0a6980376ff5670638 (patch)
tree8328666a98cd967d92ccb980a69dd41faa646c0f /src/compiler/glsl
parent1d5f4f46dae0fd809cec593683bb89dc745e15ae (diff)
glsl: don't leak memory when trying to count loop iterations
Suggested-by: Damian Dixon <[email protected]> Reviewed-by: Elie Tournier <[email protected]> Bugzilla: https://bugs.freedesktop.org/show_bug.cgi?id=99789
Diffstat (limited to 'src/compiler/glsl')
-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()