diff options
author | Milan Crha <mcrha@redhat.com> | 2012-01-04 21:53:21 +0800 |
---|---|---|
committer | Milan Crha <mcrha@redhat.com> | 2012-01-04 21:54:17 +0800 |
commit | ef8832bb8035edaad77749413afc110e9b8ea01e (patch) | |
tree | 921761e1f057b33efccf0ecfa676504064c775f1 /addressbook | |
parent | 064d9187ab85ad1987b3cd0440fec33b6254ac20 (diff) | |
download | gsoc2013-evolution-ef8832bb8035edaad77749413afc110e9b8ea01e.tar.gz gsoc2013-evolution-ef8832bb8035edaad77749413afc110e9b8ea01e.tar.zst gsoc2013-evolution-ef8832bb8035edaad77749413afc110e9b8ea01e.zip |
Bug #665036 - Memory leaks spot in Contacts view
Diffstat (limited to 'addressbook')
-rw-r--r-- | addressbook/gui/contact-editor/e-contact-editor.c | 4 | ||||
-rw-r--r-- | addressbook/gui/merging/eab-contact-merging.c | 39 | ||||
-rw-r--r-- | addressbook/gui/widgets/e-minicard.c | 2 | ||||
-rw-r--r-- | addressbook/gui/widgets/eab-contact-display.c | 5 |
4 files changed, 34 insertions, 16 deletions
diff --git a/addressbook/gui/contact-editor/e-contact-editor.c b/addressbook/gui/contact-editor/e-contact-editor.c index d1494ff366..bd7daf5258 100644 --- a/addressbook/gui/contact-editor/e-contact-editor.c +++ b/addressbook/gui/contact-editor/e-contact-editor.c @@ -1119,6 +1119,8 @@ fill_in_email (EContactEditor *editor) g_free (email_address); } + + g_list_free_full (email_attr_list, (GDestroyNotify) e_vcard_attribute_free); } static void @@ -1831,6 +1833,8 @@ fill_in_im (EContactEditor *editor) g_free (im_name); } + + g_list_free_full (im_attr_list, (GDestroyNotify) e_vcard_attribute_free); } } diff --git a/addressbook/gui/merging/eab-contact-merging.c b/addressbook/gui/merging/eab-contact-merging.c index 4efb4b8529..4309354007 100644 --- a/addressbook/gui/merging/eab-contact-merging.c +++ b/addressbook/gui/merging/eab-contact-merging.c @@ -484,7 +484,7 @@ mergeit (EContactMergingLookup *lookup) break; } gtk_widget_destroy (dialog); - g_list_free (email_attr_list); + g_list_free_full (email_attr_list, (GDestroyNotify) e_vcard_attribute_free); return value; } @@ -496,10 +496,12 @@ check_if_same (EContact *contact, GList *email_attr_list; gint num_of_email; gchar *str = NULL, *string = NULL, *string1 = NULL; + gboolean res = TRUE; - for (field = E_CONTACT_FULL_NAME; field != (E_CONTACT_LAST_SIMPLE_STRING -1); field++) { - email_attr_list = e_contact_get_attributes (match, E_CONTACT_EMAIL); - num_of_email = g_list_length (email_attr_list); + email_attr_list = e_contact_get_attributes (match, E_CONTACT_EMAIL); + num_of_email = g_list_length (email_attr_list); + + for (field = E_CONTACT_FULL_NAME; res && field != (E_CONTACT_LAST_SIMPLE_STRING -1); field++) { if ((field == E_CONTACT_EMAIL_1 || field == E_CONTACT_EMAIL_2 || field == E_CONTACT_EMAIL_3 || field == E_CONTACT_EMAIL_4) && (num_of_email < 4)) { @@ -507,33 +509,42 @@ check_if_same (EContact *contact, switch (num_of_email) { case 0: - return FALSE; + res = FALSE; + break; case 1: if ((str && *str) && (g_ascii_strcasecmp (e_contact_get_const (match, E_CONTACT_EMAIL_1),str))) - return FALSE; + res = FALSE; + break; case 2: if ((str && *str) && (g_ascii_strcasecmp (str,e_contact_get_const (match, E_CONTACT_EMAIL_1))) && (g_ascii_strcasecmp (e_contact_get_const (match, E_CONTACT_EMAIL_2),str))) - return FALSE; + res = FALSE; + break; case 3: if ((str && *str) && (g_ascii_strcasecmp (e_contact_get_const (match, E_CONTACT_EMAIL_1),str)) && (g_ascii_strcasecmp (e_contact_get_const (match, E_CONTACT_EMAIL_2),str)) && (g_ascii_strcasecmp (e_contact_get_const (match, E_CONTACT_EMAIL_3),str))) - return FALSE; + res = FALSE; + break; } } else { string = (gchar *) e_contact_get_const (contact, field); string1 = (gchar *) e_contact_get_const (match, field); - if ((string && *string) && (string1 && *string1) && (g_ascii_strcasecmp (string1,string))) - return FALSE; + if ((string && *string) && (string1 && *string1) && (g_ascii_strcasecmp (string1, string))) { + res = FALSE; + break; /*if the field entry exist in either of the contacts,we'll have to give the choice and thus merge button should be sensitive*/ - else if ((string && *string) && !(string1 && *string1)) - return FALSE; + } else if ((string && *string) && !(string1 && *string1)) { + res = FALSE; + break; + } } } - g_list_free (email_attr_list); - return TRUE; + + g_list_free_full (email_attr_list, (GDestroyNotify) e_vcard_attribute_free); + + return res; } static void diff --git a/addressbook/gui/widgets/e-minicard.c b/addressbook/gui/widgets/e-minicard.c index ddfcc1a9f9..3c13a0cd71 100644 --- a/addressbook/gui/widgets/e-minicard.c +++ b/addressbook/gui/widgets/e-minicard.c @@ -1017,7 +1017,7 @@ remodel (EMinicard *e_minicard) count = 5; else count = count + g_list_length (email); - g_list_free (email); + g_list_free_full (email, (GDestroyNotify) e_vcard_attribute_free); } else { string = e_contact_get (e_minicard->contact, field); if (string && *string) { diff --git a/addressbook/gui/widgets/eab-contact-display.c b/addressbook/gui/widgets/eab-contact-display.c index d428f8ed77..44935c4ca9 100644 --- a/addressbook/gui/widgets/eab-contact-display.c +++ b/addressbook/gui/widgets/eab-contact-display.c @@ -203,13 +203,16 @@ render_address_link (GString *buffer, adr = e_contact_get (contact, map_type); if (adr && (adr->street || adr->locality || adr->region || adr->country)) { + gchar *escaped; if (adr->street && *adr->street) g_string_append_printf (link, "%s, ", adr->street); if (adr->locality && *adr->locality) g_string_append_printf (link, "%s, ", adr->locality); if (adr->region && *adr->region) g_string_append_printf (link, "%s, ", adr->region); if (adr->country && *adr->country) g_string_append_printf (link, "%s", adr->country); - g_string_assign (link, g_uri_escape_string (link->str, NULL, TRUE)); + escaped = g_uri_escape_string (link->str, NULL, TRUE); + g_string_assign (link, escaped); + g_free (escaped); g_string_prepend (link, "<a href=\"http://maps.google.com?q="); g_string_append_printf (link, "\">%s</a>", _("Open map")); |