[perl-Glib-Object-Introspection/ppc64-fixes: 2/6] Do not try to free the "free after call" list twice



commit d66583fce6f416328525358fbe2f42a6a266e72b
Author: Torsten Schönfeld <kaffeetisch gmx de>
Date:   Fri Sep 5 18:05:26 2014 +0200

    Do not try to free the "free after call" list twice

 gperl-i11n-invoke.c |    8 ++++++--
 1 files changed, 6 insertions(+), 2 deletions(-)
---
diff --git a/gperl-i11n-invoke.c b/gperl-i11n-invoke.c
index dadc213..e52b6fe 100644
--- a/gperl-i11n-invoke.c
+++ b/gperl-i11n-invoke.c
@@ -40,15 +40,19 @@ static void
 clear_invocation_info (GPerlI11nInvocationInfo *iinfo)
 {
        g_slist_free (iinfo->free_after_call);
+       iinfo->free_after_call = NULL;
 
        /* The actual callback infos might be needed later, so we cannot free
         * them here. */
        g_slist_free (iinfo->callback_infos);
+       iinfo->callback_infos = NULL;
 
        g_slist_foreach (iinfo->array_infos, (GFunc) g_free, NULL);
        g_slist_free (iinfo->array_infos);
+       iinfo->array_infos = NULL;
 
        g_base_info_unref ((GIBaseInfo *) iinfo->return_type_info);
+       iinfo->return_type_info = NULL;
 }
 
 /* ------------------------------------------------------------------------- */
@@ -78,8 +82,8 @@ _invoke_free_closure (FreeClosure *closure)
 static void
 invoke_free_after_call_handlers (GPerlI11nInvocationInfo *iinfo)
 {
+       /* We free the FreeClosures themselves directly after invoking them.  The list
+          is freed in clear_invocation_info. */
        g_slist_foreach (iinfo->free_after_call,
                         (GFunc) _invoke_free_closure, NULL);
-       g_slist_free (iinfo->free_after_call);
-       iinfo->free_after_call = NULL;
 }


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