Fix a few Coverity issues
authorColin Leroy <colin@colino.net>
Wed, 31 Aug 2016 15:11:24 +0000 (17:11 +0200)
committerColin Leroy <colin@colino.net>
Wed, 31 Aug 2016 15:11:24 +0000 (17:11 +0200)
src/editaddress.c
src/etpan/imap-thread.c
src/filtering.c
src/gtk/gtkcmctree.c
src/gtk/gtksctree.c
src/mbox.c
src/messageview.c
src/mh.c

index 22572b1cd960ec8d5d4c20f9de427177758c8c8c..e1b5534b8d54276e56226aa63e50c0c50698a5c2 100644 (file)
@@ -1559,7 +1559,7 @@ static gboolean addressbook_edit_person_close( gboolean cancelled )
        listEMail = NULL;
        listAttrib = NULL;
 
-       if( ! cancelled ) {
+       if(!cancelled && current_person != NULL) {
                /* Set current_person stuff */          
 
                gchar *name;
index 6af12b12ef7068d96bee31fb552ee7139581d100..4bfa537c523bee6aab898d2b05f15704d7f389cf 100644 (file)
@@ -2869,7 +2869,12 @@ imap_get_envelopes_list(mailimap * imap, struct mailimap_set * set,
                r = imap_add_envelope_fetch_att(fetch_type);
        else
                r = imap_add_header_fetch_att(fetch_type);
-       
+
+       if (r != MAILIMAP_NO_ERROR) {
+               debug_print("add fetch attr: %d\n", r);
+               return r;
+       }
+
        mailstream_logger = imap_logger_fetch;
        
        r = mailimap_uid_fetch(imap, set, fetch_type, &fetch_result);
index 794b529bbbfb378b47eaf85899a5eaf1122a7a52..7b604a8e596e04588bb6b989b63d84cc6add04c1 100644 (file)
@@ -237,7 +237,7 @@ void filtering_move_and_copy_msgs(GSList *msgs)
                } else {
                        debug_print("%d messages to %s in %s\n", found,
                                cur_op==IS_COPY ? "copy":(cur_op==IS_DELE ?"delete":"move"), 
-                               last_item?(last_item->name ? last_item->name:"(noname)"):"nowhere");
+                               last_item->name ? last_item->name:"(noname)");
                }
                for (cur = batch; cur; cur = cur->next) {
                        MsgInfo *info = (MsgInfo *)cur->data;
index f8f80a6422aceed26b19b37aac34ea8b98dbcf57..d1d587df5618b923aa3c5a3e8f04d6a3b779a83d 100644 (file)
@@ -1556,7 +1556,7 @@ gtk_cmctree_link (GtkCMCTree     *ctree,
          
          list_end->next = work->next;
          if (work->next)
-           list = work->next->prev = list_end;
+           work->next->prev = list_end;
          work->next = (GList *)node;
          list = (GList *)node;
          list->prev = work;
index b7a86ee760578066d48fdff0af43a07fb889bf27..4519657d2fc7dee0ef216f6272f2efe980f259ca 100644 (file)
@@ -1451,7 +1451,7 @@ gtk_sctree_link (GtkCMCTree     *ctree,
 
                        list_end->next = work->next;
                        if (work->next)
-                               list = work->next->prev = list_end;
+                               work->next->prev = list_end;
                        work->next = (GList *)node;
                        list = (GList *)node;
                        list->prev = work;
index 6b8ad38b664381a291c417a86872ee183c8bf2a3..c0846020092149c08f57a03c92a66358863d6c37 100644 (file)
@@ -495,10 +495,6 @@ gint copy_mbox(gint srcfd, const gchar *dest)
        }
 
        while ((n_read = read(srcfd, buf, sizeof(buf))) > 0) {
-               if (n_read == -1 && errno != 0) {
-                       save_errno = errno;
-                       break;
-               }
                if (fwrite(buf, 1, n_read, dest_fp) < n_read) {
                        g_warning("writing to %s failed.", dest);
                        fclose(dest_fp);
index 9d456c46ddcb40dff2969e621d4e280b44ff58cb..e0c0d30202a241108dd23ee476826dfe9fa4e0d6 100644 (file)
@@ -2642,9 +2642,7 @@ static void goto_unread_folder_cb(GtkAction *action, gpointer data)
 static void goto_folder_cb(GtkAction *action, gpointer data)
 {
        MessageView *messageview = (MessageView *)data;
-       messageview->updating = TRUE;
        FolderItem *to_folder;
-       messageview->updating = FALSE;
 
        to_folder = foldersel_folder_sel(NULL, FOLDER_SEL_ALL, NULL, FALSE);
 
index 2ed2289ca19c7b4f997203f268c759655d9716ac..3798c64cc6d3c496da6afd809979a5a8ee41b16a 100644 (file)
--- a/src/mh.c
+++ b/src/mh.c
@@ -226,7 +226,7 @@ gboolean mh_scan_required(Folder *folder, FolderItem *item)
        if ((s.st_mtime > item->mtime) &&
                (s.st_mtime - 3600 != item->mtime)) {
                debug_print("MH scan required, folder updated: %s (%ld > %ld)\n",
-                           path?path:"(null)",
+                           path,
                            (long int) s.st_mtime,
                            (long int) item->mtime);
                g_free(path);
@@ -234,7 +234,7 @@ gboolean mh_scan_required(Folder *folder, FolderItem *item)
        }
 
        debug_print("MH scan not required: %s (%ld <= %ld)\n",
-                   path?path:"(null)",
+                   path,
                    (long int) s.st_mtime,
                    (long int) item->mtime);
        g_free(path);