diff options
author | Milan Crha <mcrha@redhat.com> | 2010-01-19 22:06:23 +0800 |
---|---|---|
committer | Milan Crha <mcrha@redhat.com> | 2010-01-19 22:06:23 +0800 |
commit | 7befe13bd00e32a181644cb1fa3349afaf4eff58 (patch) | |
tree | cd155c3c986a6dae2c06fc8a5dd08348aef4ef2d | |
parent | 8c6a11f9d834b6a56361c6499fd9cb3e11ae2a73 (diff) | |
download | gsoc2013-evolution-7befe13bd00e32a181644cb1fa3349afaf4eff58.tar.gz gsoc2013-evolution-7befe13bd00e32a181644cb1fa3349afaf4eff58.tar.zst gsoc2013-evolution-7befe13bd00e32a181644cb1fa3349afaf4eff58.zip |
Bug #603480 - [bbdb] Crash on unref of uninitialized memory
after address book error
-rw-r--r-- | plugins/bbdb/bbdb.c | 13 |
1 files changed, 7 insertions, 6 deletions
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); |