[perl-Glib-Object-Introspection] Avoid invalid memory access during callback destruction



commit 33d3cfb989d7052464f8a5d4577d6da9338ece89
Author: Torsten SchÃnfeld <kaffeetisch gmx de>
Date:   Sat Aug 11 19:19:51 2012 +0200

    Avoid invalid memory access during callback destruction

 gperl-i11n-callback.c |    7 +++++--
 1 files changed, 5 insertions(+), 2 deletions(-)
---
diff --git a/gperl-i11n-callback.c b/gperl-i11n-callback.c
index 1f91dc9..59aec95 100644
--- a/gperl-i11n-callback.c
+++ b/gperl-i11n-callback.c
@@ -64,10 +64,13 @@ release_perl_callback (gpointer data)
 	GPerlI11nPerlCallbackInfo *info = data;
 	dwarn ("releasing Perl callback info %p\n", info);
 
-	if (info->cif)
-		g_free (info->cif);
+	/* g_callable_info_free_closure reaches into info->cif, so it needs to
+	 * be called before we free it.  See
+	 * <https://bugzilla.gnome.org/show_bug.cgi?id=652954>. */
 	if (info->closure)
 		g_callable_info_free_closure (info->interface, info->closure);
+	if (info->cif)
+		g_free (info->cif);
 
 	if (info->interface)
 		g_base_info_unref ((GIBaseInfo*) info->interface);



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