]> git.ipfire.org Git - thirdparty/vala.git/commitdiff
codegen: Fix memory leak for return statements in inner blocks
authorJürg Billeter <j@bitron.ch>
Wed, 27 Apr 2011 10:51:34 +0000 (12:51 +0200)
committerJürg Billeter <j@bitron.ch>
Wed, 27 Apr 2011 11:04:10 +0000 (13:04 +0200)
variable_accessible_in_finally was not correctly working as symbol
lookup failed due to local.active set to false by visit_member_access.

codegen/valaccodebasemodule.vala

index 3b6935725065cbbfd7fd3be7944f3ed28e118769..2b4be0e499231df542aa1674f2b82010c50e86ac 100644 (file)
@@ -3353,10 +3353,7 @@ public abstract class Vala.CCodeBaseModule : CodeGenerator {
                if (stmt.return_expression != null) {
                        // avoid unnecessary ref/unref pair
                        var local = stmt.return_expression.symbol_reference as LocalVariable;
-                       if (current_return_type.value_owned
-                           && local != null && local.variable_type.value_owned
-                           && !local.captured
-                           && !variable_accessible_in_finally (local)) {
+                       if (local != null && !local.active) {
                                /* return expression is local variable taking ownership and
                                 * current method is transferring ownership */