[vala] codegen: Fix GValue memory leak after boxing



commit 885588582e4c8423fcfaabf9f5315e457f6b9d14
Author: Jürg Billeter <j bitron ch>
Date:   Thu Sep 9 19:53:54 2010 +0200

    codegen: Fix GValue memory leak after boxing
    
    Fixes bug 623543.

 codegen/valaccodebasemodule.vala |    5 +++++
 1 files changed, 5 insertions(+), 0 deletions(-)
---
diff --git a/codegen/valaccodebasemodule.vala b/codegen/valaccodebasemodule.vala
index 3f20658..837aa1d 100644
--- a/codegen/valaccodebasemodule.vala
+++ b/codegen/valaccodebasemodule.vala
@@ -4984,6 +4984,11 @@ public class Vala.CCodeBaseModule : CodeGenerator {
 			var decl = get_temp_variable (target_type, true, target_type);
 			emit_temp_var (decl);
 
+			if (!target_type.value_owned) {
+				// boxed GValue leaked, destroy it
+				temp_ref_vars.insert (0, decl);
+			}
+
 			var ccomma = new CCodeCommaExpression ();
 
 			if (target_type.nullable) {



[Date Prev][Date Next]   [Thread Prev][Thread Next]   [Thread Index] [Date Index] [Author Index]