[evolution/gnome-2-28] Bug #603480 - [bbdb] Crash on unref of uninitialized memory



commit 8196bdc0117ce1f25d123bc1b16ec9a047be28e3
Author: Milan Crha <mcrha redhat com>
Date:   Tue Jan 19 15:09:14 2010 +0100

    Bug #603480 - [bbdb] Crash on unref of uninitialized memory
    
    after address book error

 plugins/bbdb/bbdb.c |    8 ++++----
 1 files changed, 4 insertions(+), 4 deletions(-)
---
diff --git a/plugins/bbdb/bbdb.c b/plugins/bbdb/bbdb.c
index 81bad24..7360e34 100644
--- a/plugins/bbdb/bbdb.c
+++ b/plugins/bbdb/bbdb.c
@@ -275,7 +275,7 @@ 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;
 	EContact *contact;
 	gboolean status;
 	GError *error = NULL;
@@ -302,7 +302,7 @@ bbdb_do_it (EBook *book, const gchar *name, const gchar *email)
 	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);
@@ -331,12 +331,12 @@ bbdb_do_it (EBook *book, const gchar *name, const gchar *email)
 	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);



[Date Prev][Date Next]   [Thread Prev][Thread Next]   [Thread Index] [Date Index] [Author Index]