[brasero/gnome-2-28] Small memory leak



commit 4dc4523ee6e17eceaf2044c521c96bbf7588fdd1
Author: Philippe Rouquier <bonfire-app wanadoo fr>
Date:   Mon Sep 28 20:28:07 2009 +0200

    Small memory leak
    This is a harmless one as it only happen when we unref a global object before closing the program

 libbrasero-burn/burn-caps.c |   20 ++++++++++++++++++++
 libbrasero-burn/burn-caps.h |    8 ++++----
 2 files changed, 24 insertions(+), 4 deletions(-)
---
diff --git a/libbrasero-burn/burn-caps.c b/libbrasero-burn/burn-caps.c
index e11bcfb..89c33d4 100644
--- a/libbrasero-burn/burn-caps.c
+++ b/libbrasero-burn/burn-caps.c
@@ -86,8 +86,17 @@ brasero_caps_link_active (BraseroCapsLink *link)
 }
 
 static void
+brasero_caps_test_free (BraseroCapsTest *caps)
+{
+	g_slist_foreach (caps->links, (GFunc) brasero_caps_link_free, NULL);
+	g_slist_free (caps->links);
+	g_free (caps);
+}
+
+static void
 brasero_caps_free (BraseroCaps *caps)
 {
+	g_slist_free (caps->modifiers);
 	g_slist_foreach (caps->links, (GFunc) brasero_caps_link_free, NULL);
 	g_slist_free (caps->links);
 	g_free (caps);
@@ -221,6 +230,17 @@ brasero_burn_caps_finalize (GObject *object)
 	g_slist_foreach (cobj->priv->caps_list, (GFunc) brasero_caps_free, NULL);
 	g_slist_free (cobj->priv->caps_list);
 
+	if (cobj->priv->group_str) {
+		g_free (cobj->priv->group_str);
+		cobj->priv->group_str = NULL;
+	}
+
+	if (cobj->priv->tests) {
+		g_slist_foreach (cobj->priv->tests, (GFunc) brasero_caps_test_free, NULL);
+		g_slist_free (cobj->priv->tests);
+		cobj->priv->tests = NULL;
+	}
+
 	g_free (cobj->priv);
 	G_OBJECT_CLASS (parent_class)->finalize (object);
 }
diff --git a/libbrasero-burn/burn-caps.h b/libbrasero-burn/burn-caps.h
index 536ae39..7039812 100644
--- a/libbrasero-burn/burn-caps.h
+++ b/libbrasero-burn/burn-caps.h
@@ -50,8 +50,8 @@ G_BEGIN_DECLS
 #define BRASERO_BURNCAPS_GET_CLASS(o) (G_TYPE_INSTANCE_GET_CLASS ((o), BRASERO_TYPE_BURNCAPS, BraseroBurnCapsClass))
 
 struct _BraseroCaps {
-	GSList *links;
-	GSList *modifiers;
+	GSList *links;			/* BraseroCapsLink */
+	GSList *modifiers;		/* BraseroPlugin */
 	BraseroTrackType type;
 	BraseroPluginIOFlag flags;
 };
@@ -71,8 +71,8 @@ typedef struct _BraseroCapsTest BraseroCapsTest;
 
 typedef struct BraseroBurnCapsPrivate BraseroBurnCapsPrivate;
 struct BraseroBurnCapsPrivate {
-	GSList *caps_list;
-	GSList *tests;
+	GSList *caps_list;		/* BraseroCaps */
+	GSList *tests;			/* BraseroCapsTest */
 
 	GHashTable *groups;
 



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