From: Timothy Arceri Date: Fri, 17 Mar 2017 10:53:35 +0000 (+1100) Subject: glsl: don't leak memory when trying to count loop iterations X-Git-Url: https://git.libre-soc.org/?a=commitdiff_plain;h=40bc1afc9437433f2f1d1c0a6980376ff5670638;p=mesa.git glsl: don't leak memory when trying to count loop iterations Suggested-by: Damian Dixon Reviewed-by: Elie Tournier Bugzilla: https://bugs.freedesktop.org/show_bug.cgi?id=99789 --- 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()