[libpeas] Plug some memory leaks



commit 327473a6385e0b086a9e3d6b8f1f97c90126e351
Author: Paolo Borelli <pborelli gnome org>
Date:   Sat Nov 27 14:31:06 2010 +0100

    Plug some memory leaks

 libpeas/peas-extension-set.c               |    2 ++
 libpeas/peas-extension-subclasses.c        |    1 +
 loaders/python/peas-plugin-loader-python.c |    7 +++----
 3 files changed, 6 insertions(+), 4 deletions(-)
---
diff --git a/libpeas/peas-extension-set.c b/libpeas/peas-extension-set.c
index d21e8b5..8f023ae 100644
--- a/libpeas/peas-extension-set.c
+++ b/libpeas/peas-extension-set.c
@@ -511,6 +511,8 @@ peas_extension_set_call_valist (PeasExtensionSet *set,
   args = g_newa (GIArgument, n_args);
   peas_gi_valist_to_arguments (callable_info, va_args, args, NULL);
 
+  g_base_info_unref ((GIBaseInfo *) callable_info);
+
   return peas_extension_set_callv (set, method_name, args);
 }
 
diff --git a/libpeas/peas-extension-subclasses.c b/libpeas/peas-extension-subclasses.c
index c9ab34c..18140f4 100644
--- a/libpeas/peas-extension-subclasses.c
+++ b/libpeas/peas-extension-subclasses.c
@@ -208,6 +208,7 @@ implement_interface_methods (gpointer iface,
           GIVFuncInfo *vfunc_info;
           vfunc_info = g_interface_info_get_vfunc (iface_info, i);
           create_native_closure (iface_info, vfunc_info, &impls[i]);
+          g_base_info_unref ((GIBaseInfo *) vfunc_info);
         }
 
       g_type_set_qdata (exten_type, method_impl_quark (), impls);
diff --git a/loaders/python/peas-plugin-loader-python.c b/loaders/python/peas-plugin-loader-python.c
index 7f956bc..1cbdf28 100644
--- a/loaders/python/peas-plugin-loader-python.c
+++ b/loaders/python/peas-plugin-loader-python.c
@@ -265,7 +265,7 @@ peas_plugin_loader_python_load (PeasPluginLoader *loader,
 {
   PeasPluginLoaderPython *pyloader = PEAS_PLUGIN_LOADER_PYTHON (loader);
   PyObject *pymodule, *fromlist;
-  gchar *module_name;
+  const gchar *module_name;
   PyGILState_STATE state;
 
   if (pyloader->priv->init_failed)
@@ -290,15 +290,14 @@ peas_plugin_loader_python_load (PeasPluginLoader *loader,
   /* we need a fromlist to be able to import modules with a '.' in the
      name. */
   fromlist = PyTuple_New (0);
-  module_name = g_strdup (peas_plugin_info_get_module_name (info));
+  module_name = peas_plugin_info_get_module_name (info);
 
-  pymodule = PyImport_ImportModuleEx (module_name, NULL, NULL, fromlist);
+  pymodule = PyImport_ImportModuleEx ((gchar *) module_name, NULL, NULL, fromlist);
 
   Py_DECREF (fromlist);
 
   if (!pymodule)
     {
-      g_free (module_name);
       PyErr_Print ();
       pyg_gil_state_release (state);
 



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