diff options
| author | Ross Burton <rburton@src.gnome.org> | 2005-05-18 08:03:55 +0000 |
|---|---|---|
| committer | Ross Burton <rburton@src.gnome.org> | 2005-05-18 08:03:55 +0000 |
| commit | 8ab309106832bbdd7cb9bbc6f67fbc699e1c08ea (patch) | |
| tree | d93a5fac8e14d874bb2010d1fcdd773a0ae8cf7e | |
| parent | 0a0e6719c81e2266920a067a3271bc35e5a107fc (diff) | |
| download | evolution-data-server-8ab309106832bbdd7cb9bbc6f67fbc699e1c08ea.tar.gz | |
Fix memory leaks
| -rw-r--r-- | calendar/ChangeLog | 5 | ||||
| -rw-r--r-- | calendar/backends/contacts/e-cal-backend-contacts.c | 24 |
2 files changed, 23 insertions, 6 deletions
diff --git a/calendar/ChangeLog b/calendar/ChangeLog index 94a620e6f..1a1a2382a 100644 --- a/calendar/ChangeLog +++ b/calendar/ChangeLog @@ -1,3 +1,8 @@ +2005-05-18 Ross Burton <ross@burtonini.com> + + * backends/contacts/e-cal-backend-contacts.c: + Fix various memory leaks. + 2005-05-17 Sushma Rai <rsushma@novell.com> * libedata-cal/e-cal-backend-cache.c (e_cal_backend_cache_constructor): diff --git a/calendar/backends/contacts/e-cal-backend-contacts.c b/calendar/backends/contacts/e-cal-backend-contacts.c index 737a6d327..c979ec975 100644 --- a/calendar/backends/contacts/e-cal-backend-contacts.c +++ b/calendar/backends/contacts/e-cal-backend-contacts.c @@ -345,14 +345,20 @@ contacts_added_cb (EBookView *book_view, const GList *contacts, gpointer user_da for (i = contacts; i; i = i->next) { EContact *contact = E_CONTACT (i->data); + EContactDate *birthday, *anniversary; - if (e_contact_get (contact, E_CONTACT_BIRTH_DATE) || - e_contact_get (contact, E_CONTACT_ANNIVERSARY)) { + birthday = e_contact_get (contact, E_CONTACT_BIRTH_DATE); + anniversary = e_contact_get (contact, E_CONTACT_ANNIVERSARY); + + if (birthday || anniversary) { ContactRecord *cr = contact_record_new (cbc, contact); const char *uid = e_contact_get_const (contact, E_CONTACT_UID); g_hash_table_insert (cbc->priv->tracked_contacts, g_strdup (uid), cr); } + + e_contact_date_free (birthday); + e_contact_date_free (anniversary); } } @@ -461,16 +467,19 @@ create_birthday (ECalBackendContacts *cbc, EContact *contact) EContactDate *cdate; ECalComponent *cal_comp; char *summary; - const char *name, *uid; + const char *name; + char *uid; cdate = e_contact_get (contact, E_CONTACT_BIRTH_DATE); name = e_contact_get_const (contact, E_CONTACT_FILE_AS); - uid = g_strdup_printf ("%s%s", (char *) e_contact_get (contact, E_CONTACT_UID), BIRTHDAY_UID_EXT); + uid = g_strdup_printf ("%s%s", (char *) e_contact_get_const (contact, E_CONTACT_UID), BIRTHDAY_UID_EXT); summary = g_strdup_printf (_("Birthday: %s"), name); cal_comp = create_component (cbc, uid, cdate, summary); + e_contact_date_free (cdate); + g_free (uid); g_free (summary); return cal_comp; @@ -482,16 +491,19 @@ create_anniversary (ECalBackendContacts *cbc, EContact *contact) EContactDate *cdate; ECalComponent *cal_comp; char *summary; - const char *name, *uid; + const char *name; + char *uid; cdate = e_contact_get (contact, E_CONTACT_ANNIVERSARY); name = e_contact_get_const (contact, E_CONTACT_FILE_AS); - uid = g_strdup_printf ("%s%s", (char *) e_contact_get (contact, E_CONTACT_UID), ANNIVERSARY_UID_EXT); + uid = g_strdup_printf ("%s%s", (char *) e_contact_get_const (contact, E_CONTACT_UID), ANNIVERSARY_UID_EXT); summary = g_strdup_printf (_("Anniversary: %s"), name); cal_comp = create_component (cbc, uid, cdate, summary); + e_contact_date_free (cdate); + g_free (uid); g_free (summary); return cal_comp; |
