]> 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>
Sun, 29 May 2011 09:12:02 +0000 (11:12 +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 764815cc60803e4fdee617fb32c5120ca2dd6170..c466ef9b45bd2d739087f0ed56fb6ca9ebb4ead8 100644 (file)
@@ -3356,10 +3356,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 */