[gobject-introspection] tests: Fix memory leak in gi_marshalling_tests_init_function()



commit a49d4b3f64d5d37d3844ad0107968124c0a1d503
Author: Martin Pitt <martinpitt gnome org>
Date:   Mon Mar 4 10:59:22 2013 +0100

    tests: Fix memory leak in gi_marshalling_tests_init_function()
    
    In gi_marshalling_tests_init_function(), free the array string element before
    removing it. This fixes the memory leak in PyGObject's
    test_gi.TestArray.test_init_function test.

 tests/gimarshallingtests.c |    2 ++
 1 files changed, 2 insertions(+), 0 deletions(-)
---
diff --git a/tests/gimarshallingtests.c b/tests/gimarshallingtests.c
index 0869a9a..dc7fabd 100644
--- a/tests/gimarshallingtests.c
+++ b/tests/gimarshallingtests.c
@@ -1156,6 +1156,8 @@ gi_marshalling_tests_init_function (gint *n_args, char ***argv)
     return TRUE;
   (*n_args)--;
   g_assert (argv != NULL);
+  /* we have transfer ownership full, so we need to free the element ourself */
+  g_free ((*argv)[*n_args]);
   (*argv)[*n_args] = NULL;
   return TRUE;
 }


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