aboutsummaryrefslogtreecommitdiffstats
path: root/mail/mail-config.c
diff options
context:
space:
mode:
authorMilan Crha <mcrha@redhat.com>2010-06-25 02:43:16 +0800
committerMilan Crha <mcrha@redhat.com>2010-06-25 02:43:16 +0800
commit179db75ce041706a590e90a6ac7b801b36091ed6 (patch)
tree1aad2005c928c833690303d749e477e872009aa2 /mail/mail-config.c
parent9d538474a855d64e338bf7a94925cbde31a81bd5 (diff)
downloadgsoc2013-evolution-179db75ce041706a590e90a6ac7b801b36091ed6.tar
gsoc2013-evolution-179db75ce041706a590e90a6ac7b801b36091ed6.tar.gz
gsoc2013-evolution-179db75ce041706a590e90a6ac7b801b36091ed6.tar.bz2
gsoc2013-evolution-179db75ce041706a590e90a6ac7b801b36091ed6.tar.lz
gsoc2013-evolution-179db75ce041706a590e90a6ac7b801b36091ed6.tar.xz
gsoc2013-evolution-179db75ce041706a590e90a6ac7b801b36091ed6.tar.zst
gsoc2013-evolution-179db75ce041706a590e90a6ac7b801b36091ed6.zip
Bug #620815 - Memory leaks with Evolution
Diffstat (limited to 'mail/mail-config.c')
-rw-r--r--mail/mail-config.c49
1 files changed, 21 insertions, 28 deletions
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
@@ -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