[evolution] Bug #527614 - Valgrind shows a nice amount of lost memory



commit 31babe7961a6ef93419970a6d10c8843b671b466
Author: Milan Crha <mcrha redhat com>
Date:   Thu Oct 20 10:16:45 2011 +0200

    Bug #527614 - Valgrind shows a nice amount of lost memory

 e-util/e-signature-list.c            |    3 +++
 e-util/gconf-bridge.c                |    1 +
 mail/e-mail-backend.c                |   15 +++++++++------
 widgets/menus/gal-view-etable.c      |    1 +
 widgets/misc/e-account-tree-view.c   |    3 +++
 widgets/misc/e-signature-tree-view.c |    2 ++
 widgets/table/e-cell-hbox.c          |    2 +-
 widgets/table/e-cell-vbox.c          |    2 +-
 8 files changed, 21 insertions(+), 8 deletions(-)
---
diff --git a/e-util/e-signature-list.c b/e-util/e-signature-list.c
index 1f03cd3..037db0f 100644
--- a/e-util/e-signature-list.c
+++ b/e-util/e-signature-list.c
@@ -203,6 +203,9 @@ gconf_signatures_changed (GConfClient *client,
 		g_free (uid);
 	}
 
+	g_slist_foreach (list, (GFunc) g_free, NULL);
+	g_slist_free (list);
+
 	if (!have_autogen) {
 		new_sigs = add_autogen (signature_list, new_sigs);
 		resave = TRUE;
diff --git a/e-util/gconf-bridge.c b/e-util/gconf-bridge.c
index 3de48b6..7f479ac 100644
--- a/e-util/gconf-bridge.c
+++ b/e-util/gconf-bridge.c
@@ -1042,6 +1042,7 @@ list_store_binding_sync_store_to_pref (ListStoreBinding *binding)
 
 		tmp_value = gconf_value_new (GCONF_VALUE_STRING);
 		gconf_value_set_string (tmp_value, string);
+		g_free (string);
 
 		list = g_slist_append (list, tmp_value);
 
diff --git a/mail/e-mail-backend.c b/mail/e-mail-backend.c
index cb91339..be2f94e 100644
--- a/mail/e-mail-backend.c
+++ b/mail/e-mail-backend.c
@@ -544,7 +544,6 @@ mail_backend_folder_changed_cb (MailFolderCache *folder_cache,
                                 const gchar *msg_subject,
                                 EMailBackend *mail_backend)
 {
-	CamelFolder *folder = NULL;
 	EMEvent *event = em_event_peek ();
 	EMEventTargetFolder *target;
 	EMFolderTreeModel *model;
@@ -554,11 +553,15 @@ mail_backend_folder_changed_cb (MailFolderCache *folder_cache,
 
 	folder_uri = e_mail_folder_uri_build (store, folder_name);
 
-	if (mail_folder_cache_get_folder_from_uri (
-			folder_cache, folder_uri, &folder))
-		if (folder && !mail_folder_cache_get_folder_info_flags (
-				folder_cache, folder, &flags))
-			g_return_if_reached ();
+	if (folder_uri) {
+		CamelFolder *folder = NULL;
+
+		if (mail_folder_cache_get_folder_from_uri (folder_cache, folder_uri, &folder))
+			if (folder && !mail_folder_cache_get_folder_info_flags (folder_cache, folder, &flags))
+				g_return_if_reached ();
+		if (folder)
+			g_object_unref (folder);
+	}
 
 	g_free (folder_uri);
 
diff --git a/widgets/menus/gal-view-etable.c b/widgets/menus/gal-view-etable.c
index c1fa5da..a16c72b 100644
--- a/widgets/menus/gal-view-etable.c
+++ b/widgets/menus/gal-view-etable.c
@@ -134,6 +134,7 @@ gal_view_etable_clone (GalView *view)
 	new = g_object_new (GAL_TYPE_VIEW_ETABLE, NULL);
 	new->spec  = gve->spec;
 	new->title = g_strdup (gve->title);
+	g_object_unref (new->state);
 	new->state = e_table_state_duplicate (gve->state);
 
 	g_object_ref (new->spec);
diff --git a/widgets/misc/e-account-tree-view.c b/widgets/misc/e-account-tree-view.c
index 7eae4e1..bd21668 100644
--- a/widgets/misc/e-account-tree-view.c
+++ b/widgets/misc/e-account-tree-view.c
@@ -301,6 +301,9 @@ account_tree_view_refresh_timeout_cb (gpointer ptree_view)
 		COLUMN_NAME, _("Search Folders"),
 		COLUMN_PROTOCOL, NULL,
 		-1);
+
+	g_list_free (list);
+
  skip:
 	/* Restore the previously selected account. */
 	selected = e_account_tree_view_get_selected_type (tree_view);
diff --git a/widgets/misc/e-signature-tree-view.c b/widgets/misc/e-signature-tree-view.c
index 914b03e..62a923d 100644
--- a/widgets/misc/e-signature-tree-view.c
+++ b/widgets/misc/e-signature-tree-view.c
@@ -115,6 +115,8 @@ signature_tree_view_refresh_cb (ESignatureList *signature_list,
 		gtk_tree_path_free (path);
 	}
 
+	g_list_free (list);
+
 skip:
 	/* Restore the previously selected signature. */
 	signature = e_signature_tree_view_get_selected (tree_view);
diff --git a/widgets/table/e-cell-hbox.c b/widgets/table/e-cell-hbox.c
index a8eb4cc..98bbf89 100644
--- a/widgets/table/e-cell-hbox.c
+++ b/widgets/table/e-cell-hbox.c
@@ -350,5 +350,5 @@ e_cell_hbox_append (ECellHbox *hbox,
 	hbox->def_size_cols[hbox->subcell_count - 1] = size;
 
 	if (subcell)
-		g_object_ref (subcell);
+		g_object_ref_sink (subcell);
 }
diff --git a/widgets/table/e-cell-vbox.c b/widgets/table/e-cell-vbox.c
index 9830a06..bce40a8 100644
--- a/widgets/table/e-cell-vbox.c
+++ b/widgets/table/e-cell-vbox.c
@@ -338,5 +338,5 @@ e_cell_vbox_append (ECellVbox *vbox,
 	vbox->model_cols[vbox->subcell_count - 1] = model_col;
 
 	if (subcell)
-		g_object_ref (subcell);
+		g_object_ref_sink (subcell);
 }



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