From 179db75ce041706a590e90a6ac7b801b36091ed6 Mon Sep 17 00:00:00 2001 From: Milan Crha Date: Thu, 24 Jun 2010 20:43:16 +0200 Subject: Bug #620815 - Memory leaks with Evolution --- mail/e-mail-reader-utils.c | 1 + mail/em-composer-utils.c | 2 ++ mail/mail-config.c | 49 ++++++++++++++++++++-------------------------- 3 files changed, 24 insertions(+), 28 deletions(-) (limited to 'mail') diff --git a/mail/e-mail-reader-utils.c b/mail/e-mail-reader-utils.c index 539f9274b1..a1e0ebbc52 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 514885c28b..4a41217f3d 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 ab58ce8673..c7adc4ccc0 100644 --- a/mail/mail-config.c +++ b/mail/mail-config.c @@ -146,34 +146,6 @@ 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) @@ -181,7 +153,11 @@ gconf_jh_headers_changed (GConfClient *client, guint cnxn_id, 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 -- cgit v1.2.3