File bnc-220704-gal-memory-buildup.diff of Package evolution-data-server-2.6
Index: libedata-book/e-book-backend-cache.c
===================================================================
RCS file: /cvs/gnome/evolution-data-server/addressbook/libedata-book/e-book-backend-cache.c,v
retrieving revision 1.9
diff -u -p -r1.9 e-book-backend-cache.c
--- libedata-book/e-book-backend-cache.c 31 Aug 2005 04:21:51 -0000 1.9
+++ addressbook/libedata-book/e-book-backend-cache.c 1 Dec 2006 10:43:29 -0000
@@ -378,7 +378,7 @@ GList *
e_book_backend_cache_get_contacts (EBookBackendCache *cache, const char *query)
{
char *vcard_str;
- GSList *l;
+ GSList *l, *lcache;
GList *list = NULL;
EContact *contact;
EBookBackendSExp *sexp = NULL;
@@ -392,7 +392,7 @@ e_book_backend_cache_get_contacts (EBook
}
- l = e_file_cache_get_objects (E_FILE_CACHE (cache));
+ lcache = l = e_file_cache_get_objects (E_FILE_CACHE (cache));
for ( ; l != NULL; l = g_slist_next (l)) {
vcard_str = l->data;
@@ -400,18 +400,18 @@ e_book_backend_cache_get_contacts (EBook
contact = e_contact_new_from_vcard (vcard_str);
uid = e_contact_get_const (contact, E_CONTACT_UID);
if (contact && uid && *uid &&(query && e_book_backend_sexp_match_contact(sexp, contact)))
- list = g_list_append (list, contact);
+ list = g_list_prepend (list, contact);
+ else
+ g_object_unref (contact);
}
}
- if (l) {
- g_slist_foreach (l, (GFunc) g_object_unref, NULL);
- g_slist_free (l);
- }
+ if (lcache)
+ g_slist_free (lcache);
if (sexp)
g_object_unref (sexp);
- return list;
+ return g_list_reverse (list);
}
/**