]> git.ipfire.org Git - thirdparty/vala.git/commitdiff
codegen: Fix double free with GValue boxing
authorJürg Billeter <j@bitron.ch>
Wed, 6 Oct 2010 22:07:20 +0000 (00:07 +0200)
committerJürg Billeter <j@bitron.ch>
Wed, 6 Oct 2010 22:07:20 +0000 (00:07 +0200)
Fixes bug 631356.

codegen/valaccodebasemodule.vala

index 24c4dee900809e276e14c938183457140306bf60..71368d8e2b4010145f2ddf7092195113dce6a7b0 100644 (file)
@@ -4934,7 +4934,8 @@ public class Vala.CCodeBaseModule : CodeGenerator {
                                        && expression_type.data_type != gvariant_type);
 
                if (expression_type.value_owned
-                   && (target_type == null || !target_type.value_owned || boxing || unboxing)) {
+                   && (target_type == null || !target_type.value_owned || boxing || unboxing)
+                   && !gvalue_boxing /* gvalue can assume ownership of value, no need to free it */) {
                        // value leaked, destroy it
                        var pointer_type = target_type as PointerType;
                        if (pointer_type != null && !(pointer_type.base_type is VoidType)) {