[evolution] Bug #620815 - Memory leaks with Evolution



commit 179db75ce041706a590e90a6ac7b801b36091ed6
Author: Milan Crha <mcrha redhat com>
Date:   Thu Jun 24 20:43:16 2010 +0200

    Bug #620815 - Memory leaks with Evolution

 composer/e-composer-header-table.c |    2 +
 composer/e-composer-name-header.c  |    2 +
 mail/e-mail-reader-utils.c         |    1 +
 mail/em-composer-utils.c           |    2 +
 mail/mail-config.c                 |   49 +++++++++++++++--------------------
 shell/e-shell-searchbar.c          |    1 +
 shell/e-shell-window-private.c     |    2 +
 widgets/misc/e-dateedit.c          |    1 +
 8 files changed, 32 insertions(+), 28 deletions(-)
---
diff --git a/composer/e-composer-header-table.c b/composer/e-composer-header-table.c
index 4e1d523..b83bcd9 100644
--- a/composer/e-composer-header-table.c
+++ b/composer/e-composer-header-table.c
@@ -471,6 +471,7 @@ composer_header_table_from_changed_cb (EComposerHeaderTable *table)
 		composer_header_table_update_destinations (
 		old_destinations, always_cc ? account->cc_addrs : NULL);
 	e_composer_header_table_set_destinations_cc (table, new_destinations);
+	e_destination_freev (old_destinations);
 	e_destination_freev (new_destinations);
 
 	/* Update automatic BCC destinations. */
@@ -480,6 +481,7 @@ composer_header_table_from_changed_cb (EComposerHeaderTable *table)
 		composer_header_table_update_destinations (
 		old_destinations, always_bcc ? account->bcc_addrs : NULL);
 	e_composer_header_table_set_destinations_bcc (table, new_destinations);
+	e_destination_freev (old_destinations);
 	e_destination_freev (new_destinations);
 
 	/* XXX We should NOT be checking specific account types here.
diff --git a/composer/e-composer-name-header.c b/composer/e-composer-name-header.c
index 46121eb..18714ab 100644
--- a/composer/e-composer-name-header.c
+++ b/composer/e-composer-name-header.c
@@ -154,6 +154,8 @@ composer_name_header_constructor (GType type,
 		NULL);
 	E_COMPOSER_HEADER (object)->input_widget = g_object_ref_sink (entry);
 
+	g_free (label);
+
 	return object;
 }
 
diff --git a/mail/e-mail-reader-utils.c b/mail/e-mail-reader-utils.c
index 539f927..a1e0ebb 100644
--- a/mail/e-mail-reader-utils.c
+++ b/mail/e-mail-reader-utils.c
@@ -270,6 +270,7 @@ e_mail_reader_open_selected (EMailReader *reader)
 		gtk_widget_show (browser);
 	}
 
+	g_ptr_array_foreach (views, (GFunc) g_free, NULL);
 	g_ptr_array_free (views, TRUE);
 
 	em_utils_uids_free (uids);
diff --git a/mail/em-composer-utils.c b/mail/em-composer-utils.c
index 514885c..4a41217 100644
--- a/mail/em-composer-utils.c
+++ b/mail/em-composer-utils.c
@@ -1690,6 +1690,8 @@ reply_get_composer (CamelMimeMessage *message, EAccount *account,
 	 * automatic CC addresses that have already been added. */
 	e_composer_header_table_add_destinations_cc (table, ccv);
 
+	e_destination_freev (tov);
+	e_destination_freev (ccv);
 	g_free (subject);
 
 	/* add post-to, if nessecary */
diff --git a/mail/mail-config.c b/mail/mail-config.c
index ab58ce8..c7adc4c 100644
--- a/mail/mail-config.c
+++ b/mail/mail-config.c
@@ -147,41 +147,17 @@ gconf_outlook_filenames_changed (GConfClient *client, guint cnxn_id,
 }
 
 static void
-gconf_jh_check_changed (GConfClient *client, guint cnxn_id,
-		     GConfEntry *entry, gpointer user_data)
-{
-	config->jh_check = gconf_client_get_bool (config->gconf, "/apps/evolution/mail/junk/check_custom_header", NULL);
-	if (!config->jh_check) {
-		mail_session_set_junk_headers (NULL, NULL, 0);
-	} else {
-		GSList *node;
-		GPtrArray *name, *value;
-
-		config->jh_header = gconf_client_get_list (config->gconf, "/apps/evolution/mail/junk/custom_header", GCONF_VALUE_STRING, NULL);
-		node = config->jh_header;
-		name = g_ptr_array_new ();
-		value = g_ptr_array_new ();
-		while (node && node->data) {
-			gchar **tok = g_strsplit (node->data, "=", 2);
-			g_ptr_array_add (name, g_strdup(tok[0]));
-			g_ptr_array_add (value, g_strdup(tok[1]));
-			node = node->next;
-			g_strfreev (tok);
-		}
-		mail_session_set_junk_headers ((const gchar **)name->pdata, (const gchar **)value->pdata, name->len);
-		g_ptr_array_free (name, TRUE);
-		g_ptr_array_free (value, TRUE);
-	}
-}
-
-static void
 gconf_jh_headers_changed (GConfClient *client, guint cnxn_id,
                           GConfEntry *entry, gpointer user_data)
 {
 	GSList *node;
 	GPtrArray *name, *value;
 
+	g_slist_foreach (config->jh_header, (GFunc) g_free, NULL);
+	g_slist_free (config->jh_header);
+
 	config->jh_header = gconf_client_get_list (config->gconf, "/apps/evolution/mail/junk/custom_header", GCONF_VALUE_STRING, NULL);
+
 	node = config->jh_header;
 	name = g_ptr_array_new ();
 	value = g_ptr_array_new ();
@@ -193,6 +169,23 @@ gconf_jh_headers_changed (GConfClient *client, guint cnxn_id,
 		g_strfreev (tok);
 	}
 	mail_session_set_junk_headers ((const gchar **)name->pdata, (const gchar **)value->pdata, name->len);
+
+	g_ptr_array_foreach (name, (GFunc) g_free, NULL);
+	g_ptr_array_foreach (value, (GFunc) g_free, NULL);
+	g_ptr_array_free (name, TRUE);
+	g_ptr_array_free (value, TRUE);
+}
+
+static void
+gconf_jh_check_changed (GConfClient *client, guint cnxn_id,
+		     GConfEntry *entry, gpointer user_data)
+{
+	config->jh_check = gconf_client_get_bool (config->gconf, "/apps/evolution/mail/junk/check_custom_header", NULL);
+	if (!config->jh_check) {
+		mail_session_set_junk_headers (NULL, NULL, 0);
+	} else {
+		gconf_jh_headers_changed (NULL, 0, NULL, NULL);
+	}
 }
 
 static void
diff --git a/shell/e-shell-searchbar.c b/shell/e-shell-searchbar.c
index ceab21a..e8e4fe2 100644
--- a/shell/e-shell-searchbar.c
+++ b/shell/e-shell-searchbar.c
@@ -1385,6 +1385,7 @@ e_shell_searchbar_load_state (EShellSearchbar *searchbar)
 	else if (searchbar->priv->search_option != NULL)
 		gtk_radio_action_set_current_value (
 			searchbar->priv->search_option, 0);
+	g_free (string);
 
 	key = STATE_KEY_SEARCH_TEXT;
 	string = g_key_file_get_string (key_file, state_group, key, NULL);
diff --git a/shell/e-shell-window-private.c b/shell/e-shell-window-private.c
index 7e71859..200a56d 100644
--- a/shell/e-shell-window-private.c
+++ b/shell/e-shell-window-private.c
@@ -97,6 +97,8 @@ shell_window_init_switcher_style (EShellWindow *shell_window)
 
 		gtk_radio_action_set_current_value (
 			GTK_RADIO_ACTION (action), style);
+
+		g_free (string);
 	}
 
 	g_signal_connect (
diff --git a/widgets/misc/e-dateedit.c b/widgets/misc/e-dateedit.c
index 73b649d..77ffe91 100644
--- a/widgets/misc/e-dateedit.c
+++ b/widgets/misc/e-dateedit.c
@@ -2004,6 +2004,7 @@ e_date_edit_update_time_entry		(EDateEdit	*dedit)
 
 					if (strcmp (b, t) == 0) {
 						gtk_combo_box_set_active_iter (GTK_COMBO_BOX (priv->time_combo), &iter);
+						g_free (text);
 						break;
 					}
 				}



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