[anjal] BUGFIX: GNOME Bugzilla #593634 - Anjal crash: mu_get_contact() returns invalid pointer when contact



commit c7cedf1857c22e45742aa7b0ae7f2a38ee4520f7
Author: Yan Li <yan i li intel com>
Date:   Tue Sep 8 10:21:49 2009 +0800

    BUGFIX: GNOME Bugzilla #593634 - Anjal crash: mu_get_contact() returns invalid pointer when contact not found
    
    We return NULL on error now.

 src/mail-utils.c |    3 ++-
 1 files changed, 2 insertions(+), 1 deletions(-)
---
diff --git a/src/mail-utils.c b/src/mail-utils.c
index cd2a7e7..ded371b 100644
--- a/src/mail-utils.c
+++ b/src/mail-utils.c
@@ -143,7 +143,7 @@ mu_get_contact (const char *addr)
 {
 	GError *error = NULL;
 	GList *contacts = NULL;
-	EContact *contact;
+	EContact *contact = NULL;
 	EBookQuery *query;
 
 	if (!default_book) {
@@ -171,6 +171,7 @@ mu_get_contact (const char *addr)
 		g_list_free (contacts);
 	} else {
 		printf("Unable to get contact for %s\n", addr);
+		return NULL;
 	}
 
 	return contact;



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