[evolution-couchdb] Don't free the error before using it



commit 01d82f35b5fe10ab66d80d1eca053459aa7cc674
Author: Rodrigo Moya <rodrigo gnome-db org>
Date:   Thu Mar 24 17:16:47 2011 +0100

    Don't free the error before using it

 addressbook/e-book-backend-couchdb.c |   16 +++++++++++-----
 1 files changed, 11 insertions(+), 5 deletions(-)
---
diff --git a/addressbook/e-book-backend-couchdb.c b/addressbook/e-book-backend-couchdb.c
index 55a082c..d1a075a 100644
--- a/addressbook/e-book-backend-couchdb.c
+++ b/addressbook/e-book-backend-couchdb.c
@@ -1056,20 +1056,26 @@ e_book_backend_couchdb_load_source (EBookBackend *backend,
 								  db_name,
 								  &error);
 	if (couchdb_backend->database == NULL) {
-		if (error) {
+		if (error)
 			g_warning ("Could not get CouchDB database info: %s", error->message);
-			g_error_free (error);
-		}
 
 		if (only_if_exists) {
 #if EDS_CHECK_VERSION(2, 31, 0)
-			g_set_error (ret_error, ERROR_QUARK, error->code, "%s: %s",
-				     _("Could not get CouchDB database info"), error->message);
+			if (error) {
+				g_set_error (ret_error, ERROR_QUARK, error->code, "%s: %s",
+					     _("Could not get CouchDB database info"), error->message);
+				g_error_free (error);
+			} else
+				g_set_error (ret_error, ERROR_QUARK, 0, _("Could not open database %s"), db_name);
+
 			return;
 #else
 			return GNOME_Evolution_Addressbook_NoSuchBook;
 #endif
 		}
+
+		if (error)
+			g_error_free (error);
 		
 		/* if it does not exist, create it */
 		error = NULL;



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