]> 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>
Fri, 8 Oct 2010 21:06:56 +0000 (23:06 +0200)
Fixes bug 631356.

codegen/valaccodebasemodule.vala

index 0be274592c7f2f84ce3a6efa693feddef023632c..e263e8fa53a38f300cf6df19a8004c0628b86acf 100644 (file)
@@ -5166,7 +5166,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)) {