diff options
author | Hiroyuki Ikezoe <poincare@ikezoe.net> | 2007-07-26 17:22:14 +0800 |
---|---|---|
committer | Hiroyuki Ikezoe <hiikezoe@src.gnome.org> | 2007-07-26 17:22:14 +0800 |
commit | ebbe5a9fa3421f2004b90d2c5c7a7496ffc8c5a7 (patch) | |
tree | b271bfee3f76d7d0f2c717f34aadb7ad7dc582e9 | |
parent | 18727feb7f3cf993011d17d3dac12e1c55df5238 (diff) | |
download | gsoc2013-evolution-ebbe5a9fa3421f2004b90d2c5c7a7496ffc8c5a7.tar.gz gsoc2013-evolution-ebbe5a9fa3421f2004b90d2c5c7a7496ffc8c5a7.tar.zst gsoc2013-evolution-ebbe5a9fa3421f2004b90d2c5c7a7496ffc8c5a7.zip |
Plugged memory leak and the second argument of g_utf8_strdown() should be
2007-07-26 Hiroyuki Ikezoe <poincare@ikezoe.net>
* attachment-reminder.c: Plugged memory leak and the second argument
of g_utf8_strdown() should be in bytes.
svn path=/trunk/; revision=33842
-rw-r--r-- | plugins/attachment-reminder/ChangeLog | 5 | ||||
-rw-r--r-- | plugins/attachment-reminder/attachment-reminder.c | 30 |
2 files changed, 26 insertions, 9 deletions
diff --git a/plugins/attachment-reminder/ChangeLog b/plugins/attachment-reminder/ChangeLog index 3fc10c69c0..9776047d27 100644 --- a/plugins/attachment-reminder/ChangeLog +++ b/plugins/attachment-reminder/ChangeLog @@ -1,3 +1,8 @@ +2007-07-26 Hiroyuki Ikezoe <poincare@ikezoe.net> + + * attachment-reminder.c: Plugged memory leak and the second argument + of g_utf8_strdown() should be in bytes. + 2007-07-17 Sankar P <psankar@novell.com> * org-gnome-attachment-reminder.errors.xml: diff --git a/plugins/attachment-reminder/attachment-reminder.c b/plugins/attachment-reminder/attachment-reminder.c index 0384ad54d7..7f8819385f 100644 --- a/plugins/attachment-reminder/attachment-reminder.c +++ b/plugins/attachment-reminder/attachment-reminder.c @@ -125,7 +125,8 @@ static gboolean check_for_attachment_clues (gchar *msg) //TODO : Add more strings. RegEx ??? GConfClient *gconf; - GSList *clue_list = NULL; + GSList *clue_list = NULL, *list; + gboolean ret_val = FALSE; gconf = gconf_client_get_default (); @@ -134,12 +135,20 @@ static gboolean check_for_attachment_clues (gchar *msg) guint msg_length = strlen (msg); - for (;clue_list;clue_list=g_slist_next(clue_list)) { - if (g_strstr_len (msg, msg_length, g_utf8_strdown (clue_list->data, g_utf8_strlen (clue_list->data, -1) ) )) - return TRUE; + for (list = clue_list;list && !ret_val;list=g_slist_next(list)) { + gchar *needle = g_utf8_strdown (list->data, -1); + if (g_strstr_len (msg, msg_length, needle)) { + ret_val = TRUE; + } + g_free (needle); } - return FALSE; + if (clue_list) { + g_slist_foreach (clue_list, (GFunc) g_free, NULL); + g_slist_free (clue_list); + } + + return ret_val; } /* check for the any attachment */ @@ -338,7 +347,7 @@ org_gnome_attachment_reminder_config_option (struct _EPlugin *epl, struct _EConf GtkTreeIter iter; GConfClient *gconf = gconf_client_get_default(); GtkWidget *hbox, *button; - GSList *clue_list = NULL; + GSList *clue_list = NULL, *list; gboolean enable_ui; UIData *ui = g_new0 (UIData, 1); @@ -392,12 +401,15 @@ org_gnome_attachment_reminder_config_option (struct _EPlugin *epl, struct _EConf /* Populate tree view with values from gconf */ clue_list = gconf_client_get_list ( gconf, GCONF_KEY_ATTACH_REMINDER_CLUES, GCONF_VALUE_STRING, NULL ); - while (clue_list){ + for (list = clue_list; list; list = g_slist_next (clue_list)) { gtk_list_store_append (store, &iter); gtk_list_store_set (store, &iter, - CLUE_KEYWORD_COLUMN, clue_list->data, -1); + CLUE_KEYWORD_COLUMN, list->data, -1); + } - clue_list = g_slist_next (clue_list); + if (clue_list) { + g_slist_foreach (clue_list, (GFunc) g_free, NULL); + g_slist_free (clue_list); } /* Enable / Disable */ |