From 7befe13bd00e32a181644cb1fa3349afaf4eff58 Mon Sep 17 00:00:00 2001 From: Milan Crha Date: Tue, 19 Jan 2010 15:06:23 +0100 Subject: Bug #603480 - [bbdb] Crash on unref of uninitialized memory after address book error --- plugins/bbdb/bbdb.c | 13 +++++++------ 1 file changed, 7 insertions(+), 6 deletions(-) (limited to 'plugins') diff --git a/plugins/bbdb/bbdb.c b/plugins/bbdb/bbdb.c index a9056b1d34..d9b1967f2e 100644 --- a/plugins/bbdb/bbdb.c +++ b/plugins/bbdb/bbdb.c @@ -313,7 +313,8 @@ bbdb_do_it (EBook *book, const gchar *name, const gchar *email) { gchar *query_string, *delim, *temp_name = NULL; EBookQuery *query; - GList *contacts, *l; + GList *contacts = NULL, *l; + gboolean status; EContact *contact; GError *error = NULL; @@ -336,10 +337,10 @@ bbdb_do_it (EBook *book, const gchar *name, const gchar *email) query = e_book_query_from_string (query_string); g_free (query_string); - e_book_get_contacts (book, query, &contacts, NULL); + status = e_book_get_contacts (book, query, &contacts, NULL); if (query) e_book_query_unref (query); - if (contacts != NULL) { + if (contacts != NULL || !status) { for (l = contacts; l != NULL; l = l->next) g_object_unref ((GObject *)l->data); g_list_free (contacts); @@ -365,15 +366,15 @@ bbdb_do_it (EBook *book, const gchar *name, const gchar *email) query = e_book_query_from_string (query_string); g_free (query_string); - e_book_get_contacts (book, query, &contacts, NULL); + status = e_book_get_contacts (book, query, &contacts, NULL); if (query) e_book_query_unref (query); - if (contacts != NULL) { + if (contacts != NULL || !status) { /* FIXME: If there's more than one contact with this name, just give up; we're not smart enough for this. */ - if (contacts->next != NULL) { + if (!status || contacts->next != NULL) { for (l = contacts; l != NULL; l = l->next) g_object_unref ((GObject *)l->data); g_list_free (contacts); -- cgit