[evolution-patches] Leak fixes in the Birthdays backend
- From: Ross Burton <ross burtonini com>
- To: Evolution Patches <evolution-patches lists ximian com>
- Subject: [evolution-patches] Leak fixes in the Birthdays backend
- Date: Tue, 17 May 2005 15:20:13 +0100
Hi,
The Birthday And Anniversary calendar backend has several leaks in, the
attached patch fixes them. On commit I'll add a changelog entry,
obviously.
Ross
--
Ross Burton mail: ross burtonini com
jabber: ross burtonini com
www: http://www.burtonini.com./
PGP Fingerprint: 1A21 F5B0 D8D0 CFE3 81D4 E25A 2D09 E447 D0B4 33DF
Index: calendar/backends/contacts/e-cal-backend-contacts.c
===================================================================
RCS file: /cvs/gnome/evolution-data-server/calendar/backends/contacts/e-cal-backend-contacts.c,v
retrieving revision 1.17.2.1
diff -u -r1.17.2.1 e-cal-backend-contacts.c
--- calendar/backends/contacts/e-cal-backend-contacts.c 16 Mar 2005 10:08:13 -0000 1.17.2.1
+++ calendar/backends/contacts/e-cal-backend-contacts.c 17 May 2005 14:18:49 -0000
@@ -345,14 +345,20 @@
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 @@
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 @@
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;
[
Date Prev][
Date Next] [
Thread Prev][
Thread Next]
[
Thread Index]
[
Date Index]
[
Author Index]