[rygel-gst-0-10-plugins] Plug some leaks.



commit 55b4d974b8cb1b57f7e3733fcbd52900183a656e
Author: Krzesimir Nowak <krnowak openismus com>
Date:   Tue Feb 5 16:00:47 2013 +0100

    Plug some leaks.

 src/media-export/rygel-media-export-media-cache.c |    1 +
 src/media-export/rygel-media-export-plugin.c      |   14 +++++++++-----
 tests/test_simple.c                               |    8 ++++++--
 3 files changed, 16 insertions(+), 7 deletions(-)
---
diff --git a/src/media-export/rygel-media-export-media-cache.c b/src/media-export/rygel-media-export-media-cache.c
index 036dd6d..836b801 100644
--- a/src/media-export/rygel-media-export-media-cache.c
+++ b/src/media-export/rygel-media-export-media-cache.c
@@ -418,6 +418,7 @@ rygel_media_export_media_cache_get_child_count (RygelMediaExportMediaCache  *sel
   g_value_set_string (&value, container_id);
   inner_error = NULL;
   count = rygel_media_export_media_cache_query_value (self, RYGEL_MEDIA_EXPORT_SQL_STRING_CHILD_COUNT, &value, 1, &inner_error);
+  g_value_unset (&value);
   if (inner_error != NULL) {
     g_propagate_error (error, inner_error);
     return 0;
diff --git a/src/media-export/rygel-media-export-plugin.c b/src/media-export/rygel-media-export-plugin.c
index 14911a2..7c64c86 100644
--- a/src/media-export/rygel-media-export-plugin.c
+++ b/src/media-export/rygel-media-export-plugin.c
@@ -51,12 +51,14 @@ void module_init (RygelPluginLoader *loader) {
   }
 
   rygel_plugin_loader_add_plugin (loader, RYGEL_PLUGIN (plugin));
+  g_object_unref (plugin);
 }
 
 RygelMediaExportPlugin*
 rygel_media_export_plugin_new (GError **error) {
   RygelMediaContainer *root;
   GError *inner_error = NULL;
+  RygelMediaExportPlugin* plugin;
 
   rygel_media_export_root_container_ensure_exists (&inner_error);
   if (inner_error) {
@@ -64,11 +66,13 @@ rygel_media_export_plugin_new (GError **error) {
     return  NULL;
   }
   root = rygel_media_export_root_container_get_instance ();
-  return RYGEL_MEDIA_EXPORT_PLUGIN (rygel_media_server_plugin_construct (RYGEL_MEDIA_EXPORT_TYPE_PLUGIN,
-									 root,
-									 RYGEL_MEDIA_EXPORT_PLUGIN_NAME,
-									 NULL,
-									 RYGEL_PLUGIN_CAPABILITIES_UPLOAD));
+  plugin = RYGEL_MEDIA_EXPORT_PLUGIN (rygel_media_server_plugin_construct (RYGEL_MEDIA_EXPORT_TYPE_PLUGIN,
+									   root,
+									   RYGEL_MEDIA_EXPORT_PLUGIN_NAME,
+									   NULL,
+									   RYGEL_PLUGIN_CAPABILITIES_UPLOAD));
+  g_object_unref (root);
+  return plugin;
 }
 
 static void
diff --git a/tests/test_simple.c b/tests/test_simple.c
index ae2a4f7..ee0175e 100644
--- a/tests/test_simple.c
+++ b/tests/test_simple.c
@@ -64,12 +64,16 @@ int main(int argc, char *argv[])
   /* Check the plugin's root container: */
   root_container = rygel_media_server_plugin_get_root_container (plugin);
   g_assert (root_container);
-  g_assert (RYGEL_MEDIA_EXPORT_IS_ROOT_CONTAINER (root_container) || RYGEL_MEDIA_EXPORT_IS_NULL_CONTAINER (root_container));
+  g_assert (RYGEL_MEDIA_EXPORT_IS_ROOT_CONTAINER (root_container));
 
   /* unref: */
-  g_object_unref (root_container);
   g_object_unref (plugin);
+  g_object_unref (iter);
+  g_object_unref (list_plugins);
   g_object_unref (loader);
 
+  /* Root container is a singleton so unref it here. */
+  g_object_unref (root_container);
+
   return 0;
 }



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