Fix few issues found by Coverity scan
authorMilan Crha <mcrha@redhat.com>
Fri, 30 Nov 2012 10:06:18 +0000 (11:06 +0100)
committerMilan Crha <mcrha@redhat.com>
Fri, 30 Nov 2012 10:06:18 +0000 (11:06 +0100)
camel/camel-search-sql-sexp.c
camel/providers/imap/camel-imap-folder.c
camel/providers/imap/camel-imap-summary.c
camel/providers/local/camel-mbox-summary.c
camel/providers/nntp/camel-nntp-store.c
libedataserverui/e-name-selector-entry.c

index 356c78e..4007e48 100644 (file)
@@ -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 ();
 
index 3a09c07..7610230 100644 (file)
@@ -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);
index 2fe5a96..3f2396e 100644 (file)
@@ -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;
 }
 
 /**
index 7ca10e5..71c0091 100644 (file)
@@ -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
index acf908f..3b01b03 100644 (file)
@@ -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 '%':
index cd8cc79..87a6b31 100644 (file)
@@ -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;