Package: mono-jit
Version: 1.2.4-4
Severity: minor
Tags: patch upstream fixed-upstream

When passing delegates to unmanaged code under certain circumstances, a small
memory leak can result.  If many such calls are made in a short period time
this can be a serious issue.

This was reported to the Ximian Bugzilla and was later fixed in SVN; I have
attached the appropriate diff, excluding the changes to a ChangeLog as this
causes the patch to fail against the source deb.

I am suggesting that this patch be included in Debian's build because it
affects at least every Gtk# application that uses GLib.Idle.

-- 
Chris Howie
http://www.chrishowie.com
http://en.wikipedia.org/wiki/User:Crazycomputers

-----BEGIN GEEK CODE BLOCK-----
Version: 3.1
GCS/IT d-(--) s:- a-->? C++(+++)$> UL++++ P++++$ L+++>++++ E---
W++ N o++ K? w--$ O M- V- PS--(---) PE++ Y+ PGP++ t+ 5? X-
R(+)>- tv-(--) b- DI+> D++ G>+++ e>++ h(--)>--- !r>+++ y->+++
------END GEEK CODE BLOCK------
Index: mono/metadata/loader.c
===================================================================
--- mono/metadata/loader.c	(revision 79000)
+++ mono/metadata/loader.c	(revision 79001)
@@ -1537,17 +1537,11 @@
 		g_free ((char*)method->name);
 		if (mw->method.header)
 			g_free ((char*)mw->method.header->code);
+		g_free (mw->method.header);
 		g_free (mw->method_data);
-	}
-
-	if (method->dynamic && !(method->iflags & METHOD_IMPL_ATTRIBUTE_INTERNAL_CALL) && ((MonoMethodNormal *)method)->header) {
-		/* FIXME: Ditto */
-		/* mono_metadata_free_mh (((MonoMethodNormal *)method)->header); */
-		g_free (((MonoMethodNormal*)method)->header);
-	}
-
-	if (method->dynamic)
+		g_free (method->signature);
 		g_free (method);
+	}
 }
 
 void
Index: mono/metadata/marshal.c
===================================================================
--- mono/metadata/marshal.c	(revision 79000)
+++ mono/metadata/marshal.c	(revision 79001)
@@ -8787,7 +8787,11 @@
 
 
 	/* we copy the signature, so that we can modify it */
-	csig = signature_dup (method->klass->image, sig);
+	if (this)
+		/* Need to free this later */
+		csig = mono_metadata_signature_dup (sig);
+	else
+		csig = signature_dup (method->klass->image, sig);
 	csig->hasthis = 0;
 	csig->pinvoke = 1;
 

Attachment: signature.asc
Description: OpenPGP digital signature

Reply via email to