aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorMilan Crha <mcrha@redhat.com>2012-01-04 21:53:21 +0800
committerMilan Crha <mcrha@redhat.com>2012-01-04 21:54:17 +0800
commitef8832bb8035edaad77749413afc110e9b8ea01e (patch)
tree921761e1f057b33efccf0ecfa676504064c775f1
parent064d9187ab85ad1987b3cd0440fec33b6254ac20 (diff)
downloadgsoc2013-evolution-ef8832bb8035edaad77749413afc110e9b8ea01e.tar
gsoc2013-evolution-ef8832bb8035edaad77749413afc110e9b8ea01e.tar.gz
gsoc2013-evolution-ef8832bb8035edaad77749413afc110e9b8ea01e.tar.bz2
gsoc2013-evolution-ef8832bb8035edaad77749413afc110e9b8ea01e.tar.lz
gsoc2013-evolution-ef8832bb8035edaad77749413afc110e9b8ea01e.tar.xz
gsoc2013-evolution-ef8832bb8035edaad77749413afc110e9b8ea01e.tar.zst
gsoc2013-evolution-ef8832bb8035edaad77749413afc110e9b8ea01e.zip
Bug #665036 - Memory leaks spot in Contacts view
-rw-r--r--addressbook/gui/contact-editor/e-contact-editor.c4
-rw-r--r--addressbook/gui/merging/eab-contact-merging.c39
-rw-r--r--addressbook/gui/widgets/e-minicard.c2
-rw-r--r--addressbook/gui/widgets/eab-contact-display.c5
-rw-r--r--e-util/e-sorter-array.c15
-rw-r--r--modules/addressbook/e-book-shell-view-private.c3
6 files changed, 52 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"));
diff --git a/e-util/e-sorter-array.c b/e-util/e-sorter-array.c
index b36eb06007..106a2d66ca 100644
--- a/e-util/e-sorter-array.c
+++ b/e-util/e-sorter-array.c
@@ -248,6 +248,18 @@ e_sorter_array_append (ESorterArray *esa,
}
}
+static void
+esa_finalize (GObject *object)
+{
+ ESorterArray *esa = E_SORTER_ARRAY (object);
+
+ if (esa)
+ e_sorter_array_clean (esa);
+
+ /* Chain up to parent's finalize() method. */
+ G_OBJECT_CLASS (e_sorter_array_parent_class)->finalize (object);
+}
+
ESorterArray *
e_sorter_array_construct (ESorterArray *esa,
ECreateCmpCacheFunc create_cmp_cache,
@@ -273,8 +285,11 @@ e_sorter_array_new (ECreateCmpCacheFunc create_cmp_cache,
static void
e_sorter_array_class_init (ESorterArrayClass *klass)
{
+ GObjectClass *object_class = G_OBJECT_CLASS (klass);
ESorterClass *sorter_class = E_SORTER_CLASS (klass);
+ object_class->finalize = esa_finalize;
+
sorter_class->model_to_sorted = esa_model_to_sorted;
sorter_class->sorted_to_model = esa_sorted_to_model;
sorter_class->get_model_to_sorted_array = esa_get_model_to_sorted_array;
diff --git a/modules/addressbook/e-book-shell-view-private.c b/modules/addressbook/e-book-shell-view-private.c
index cb0cf60ab2..3c3b1a9a8f 100644
--- a/modules/addressbook/e-book-shell-view-private.c
+++ b/modules/addressbook/e-book-shell-view-private.c
@@ -95,6 +95,9 @@ book_shell_view_selection_change_foreach (gint row,
e_book_shell_content_set_preview_contact (book_shell_content, contact);
book_shell_view->priv->preview_index = row;
+
+ if (contact)
+ g_object_unref (contact);
}
static void