]> git.ipfire.org Git - thirdparty/vala.git/commitdiff
codegen: Fix memory leak when chaining up in fundamental classes
authorJürg Billeter <j@bitron.ch>
Sun, 11 Nov 2012 19:12:45 +0000 (20:12 +0100)
committerJürg Billeter <j@bitron.ch>
Tue, 13 Nov 2012 20:13:53 +0000 (21:13 +0100)
Fixes bug 684776.

codegen/valaccodemethodmodule.vala

index d6b8cf421250c612e56ceae6f99fd3370828dfea..f26ed71a910b4e42edab6f65e0c3f1253931dba2 100644 (file)
@@ -606,7 +606,7 @@ public abstract class Vala.CCodeMethodModule : CCodeStructModule {
                                                var cl = (Class) m.parent_symbol;
                                                ccode.add_declaration (get_ccode_name (cl) + "*", new CCodeVariableDeclarator.zero ("self", new CCodeConstant ("NULL")));
 
-                                               if (cl.is_fundamental ()) {
+                                               if (cl.is_fundamental () && !((CreationMethod) m).chain_up) {
                                                        var ccall = new CCodeFunctionCall (new CCodeIdentifier ("g_type_create_instance"));
                                                        ccall.add_argument (get_variable_cexpression ("object_type"));
                                                        ccode.add_assignment (get_this_cexpression (), new CCodeCastExpression (ccall, get_ccode_name (cl) + "*"));