[libpeas] Fix memory leaks



commit fce4e09f2f6f647dc254a57bf5751839d2f67493
Author: Garrett Regier <garrettregier gmail com>
Date:   Sat Feb 11 11:25:02 2012 -0800

    Fix memory leaks

 loaders/seed/peas-plugin-loader-seed.c    |    4 +---
 tests/libpeas/testing/testing-extension.c |   10 ++++++++--
 tests/testing-util/testing-util.c         |    2 ++
 tests/valgrind.suppressions               |   28 ++++++++++++++++++++++++++++
 4 files changed, 39 insertions(+), 5 deletions(-)
---
diff --git a/loaders/seed/peas-plugin-loader-seed.c b/loaders/seed/peas-plugin-loader-seed.c
index 668b639..5c517a3 100644
--- a/loaders/seed/peas-plugin-loader-seed.c
+++ b/loaders/seed/peas-plugin-loader-seed.c
@@ -292,13 +292,11 @@ peas_plugin_loader_seed_create_extension (PeasPluginLoader *loader,
         {
           g_array_append_val (interfaces, the_type);
         }
-
-      g_free (property_name);
     }
 
   g_array_sort (interfaces, (GCompareFunc) prerequisites_sort);
 
-  g_free (property_names);
+  g_strfreev (property_names);
 
   return peas_extension_seed_new (exten_type,
                                   (GType *) g_array_free (interfaces, FALSE),
diff --git a/tests/libpeas/testing/testing-extension.c b/tests/libpeas/testing/testing-extension.c
index b10293c..03be1be 100644
--- a/tests/libpeas/testing/testing-extension.c
+++ b/tests/libpeas/testing/testing-extension.c
@@ -47,11 +47,17 @@ struct _TestFixture {
   PeasPluginInfo *info;
 };
 
-#define I_(s) (g_ptr_array_add (interned_strings, (s)), (const gchar *) (s))
-
 static GPtrArray *interned_strings = NULL;
 static const gchar *extension_plugin = NULL;
 
+static const gchar *
+I_(gchar *s)
+{
+  g_ptr_array_add (interned_strings, s);
+
+  return s;
+}
+
 static void
 test_setup (TestFixture    *fixture,
             gconstpointer  data)
diff --git a/tests/testing-util/testing-util.c b/tests/testing-util/testing-util.c
index d52c887..28840ce 100644
--- a/tests/testing-util/testing-util.c
+++ b/tests/testing-util/testing-util.c
@@ -129,6 +129,8 @@ testing_util_init (void)
 
   g_log_set_default_handler (log_handler, NULL);
 
+  g_setenv ("GSETTINGS_BACKEND", "memory", TRUE);
+
   g_irepository_prepend_search_path (BUILDDIR "/libpeas");
 
   g_setenv ("PEAS_PLUGIN_LOADERS_DIR", BUILDDIR "/loaders", TRUE);
diff --git a/tests/valgrind.suppressions b/tests/valgrind.suppressions
index ba86df4..d8af10b 100644
--- a/tests/valgrind.suppressions
+++ b/tests/valgrind.suppressions
@@ -159,6 +159,34 @@
 
 
 {
+  g_module_open
+  Memcheck:Cond
+  ...
+  fun:g_module_open
+}
+{
+  _dl_relocate_object
+  Memcheck:Cond
+  ...
+  fun:_dl_relocate_object
+}
+{
+  _dl_start
+  Memcheck:Cond
+  ...
+  fun:_dl_start
+}
+
+
+{
+  g_vfs_get_default
+  Memcheck:Leak
+  ...
+  fun:g_vfs_get_default
+}
+
+
+{
   gtk_init_check
   Memcheck:Leak
   ...



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