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

Author: Timothy Arceri <[email protected]>
Date:   Fri Mar 17 21:53:35 2017 +1100

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

---

 src/compiler/glsl/loop_controls.cpp | 5 +++--
 1 file changed, 3 insertions(+), 2 deletions(-)

diff --git a/src/compiler/glsl/loop_controls.cpp 
b/src/compiler/glsl/loop_controls.cpp
index c717605ec7..fa739afa24 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()

_______________________________________________
mesa-commit mailing list
[email protected]
https://lists.freedesktop.org/mailman/listinfo/mesa-commit

Reply via email to