[evolution-data-server] Fix few issues found by Coverity scan



commit 55ce98fd1ba694ee4bf398d07def2310a1c1d7e3
Author: Milan Crha <mcrha redhat com>
Date:   Fri Nov 30 11:06:18 2012 +0100

    Fix few issues found by Coverity scan

 camel/camel-search-sql-sexp.c              |    2 +-
 camel/providers/imap/camel-imap-folder.c   |    2 +-
 camel/providers/imap/camel-imap-summary.c  |    2 +-
 camel/providers/local/camel-mbox-summary.c |    4 ++++
 camel/providers/nntp/camel-nntp-store.c    |    2 +-
 libedataserverui/e-name-selector-entry.c   |    2 +-
 6 files changed, 9 insertions(+), 5 deletions(-)
---
diff --git a/camel/camel-search-sql-sexp.c b/camel/camel-search-sql-sexp.c
index 356c78e..4007e48 100644
--- a/camel/camel-search-sql-sexp.c
+++ b/camel/camel-search-sql-sexp.c
@@ -715,7 +715,7 @@ camel_sexp_to_sql_sexp (const gchar *sql)
 	CamelSExp *sexp;
 	CamelSExpResult *r;
 	gint i;
-	gchar *res;
+	gchar *res = NULL;
 
 	sexp = camel_sexp_new ();
 
diff --git a/camel/providers/imap/camel-imap-folder.c b/camel/providers/imap/camel-imap-folder.c
index 3a09c07..7610230 100644
--- a/camel/providers/imap/camel-imap-folder.c
+++ b/camel/providers/imap/camel-imap-folder.c
@@ -1193,7 +1193,7 @@ imap_rescan (CamelFolder *folder,
 		g_datalist_clear (&data);
 	}
 
-	if (summary_got == 0 && summary_len == 0) {
+	if (summary_got == 0) {
 		camel_operation_pop_message (cancellable);
 		g_free (new);
 		g_free (resp);
diff --git a/camel/providers/imap/camel-imap-summary.c b/camel/providers/imap/camel-imap-summary.c
index 2fe5a96..3f2396e 100644
--- a/camel/providers/imap/camel-imap-summary.c
+++ b/camel/providers/imap/camel-imap-summary.c
@@ -111,7 +111,7 @@ sort_uid_cmp (gpointer enc,
 	a1 = strtoul (sa1, NULL, 10);
 	a2 = strtoul (sa2, NULL, 10);
 
-	return (a1 < a1) ? -1 : (a1 > a2) ? 1 : 0;
+	return (a1 < a2) ? -1 : (a1 > a2) ? 1 : 0;
 }
 
 /**
diff --git a/camel/providers/local/camel-mbox-summary.c b/camel/providers/local/camel-mbox-summary.c
index 7ca10e5..71c0091 100644
--- a/camel/providers/local/camel-mbox-summary.c
+++ b/camel/providers/local/camel-mbox-summary.c
@@ -697,6 +697,8 @@ mbox_summary_sync_full (CamelMboxSummary *mbs,
 		goto error;
 	}
 
+	fd = -1;
+
 	if (close (fdout) == -1) {
 		g_warning ("Cannot close temporary folder: %s", g_strerror (errno));
 		g_set_error (
@@ -708,6 +710,8 @@ mbox_summary_sync_full (CamelMboxSummary *mbs,
 		goto error;
 	}
 
+	fdout = -1;
+
 	/* this should probably either use unlink/link/unlink, or recopy over
 	 * the original mailbox, for various locking reasons/etc */
 #ifdef G_OS_WIN32
diff --git a/camel/providers/nntp/camel-nntp-store.c b/camel/providers/nntp/camel-nntp-store.c
index acf908f..3b01b03 100644
--- a/camel/providers/nntp/camel-nntp-store.c
+++ b/camel/providers/nntp/camel-nntp-store.c
@@ -1566,7 +1566,7 @@ camel_nntp_raw_commandv (CamelNNTPStore *store,
 	stream = CAMEL_STREAM (store->mem);
 
 	while ((c = *p++)) {
-		gchar *strval;
+		gchar *strval = NULL;
 
 		switch (c) {
 		case '%':
diff --git a/libedataserverui/e-name-selector-entry.c b/libedataserverui/e-name-selector-entry.c
index cd8cc79..87a6b31 100644
--- a/libedataserverui/e-name-selector-entry.c
+++ b/libedataserverui/e-name-selector-entry.c
@@ -2547,7 +2547,7 @@ find_client_by_contact (GSList *clients,
 {
 	GSList *l;
 
-	if (source_uid && source_uid) {
+	if (source_uid && *source_uid) {
 		/* this is much quicket than asking each client for an existence */
 		for (l = clients; l; l = g_slist_next (l)) {
 			EBookClient *client = l->data;



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