]> granicus.if.org Git - neomutt/commitdiff
fix coverity defects
authorRichard Russon <rich@flatcap.org>
Fri, 16 Nov 2018 18:49:15 +0000 (18:49 +0000)
committerRichard Russon <rich@flatcap.org>
Sun, 18 Nov 2018 17:34:59 +0000 (17:34 +0000)
compose.c
email/url.c
enriched.c
imap/imap.c
mbox/mbox.c
terminal.c

index 60446e7dc5914f40c07cb55911ed1db1577ae93a..aeb2f3da79e8e3760daa601180c22246cbfc6c13 100644 (file)
--- a/compose.c
+++ b/compose.c
@@ -1399,7 +1399,7 @@ int mutt_compose_menu(struct Email *msg, char *fcc, size_t fcclen, struct Email
 
 #ifdef USE_NNTP
         OptNews = false;
-        if (op == OP_COMPOSE_ATTACH_NEWS_MESSAGE)
+        if (Context && (op == OP_COMPOSE_ATTACH_NEWS_MESSAGE))
         {
           CurrentNewsSrv = nntp_select_server(Context->mailbox, NewsServer, false);
           if (!CurrentNewsSrv)
index a5092e4056f36c5cfe2a537df39454fb446d2d23..e06a0bc3d27d5064e43a064e7733ce62ca29028d 100644 (file)
@@ -289,6 +289,9 @@ err:
  */
 void url_free(struct Url **u)
 {
+  if (!u || !*u)
+    return;
+
   struct UrlQueryString *np = STAILQ_FIRST(&(*u)->query_strings), *next = NULL;
   while (np)
   {
index 70c4ad7f4566a8dd70a74e465200789917dd904e..02d697eb077b8016c3430267daf33b3668338cf2 100644 (file)
@@ -573,7 +573,8 @@ int text_enriched_handler(struct Body *a, struct State *s)
         state = DONE;
         break;
 
-      case DONE: /* not reached */
+      case DONE:
+        /* not reached */
         break;
     }
   }
index fa3f530a2cf9106be96794b096a7dbfb09ad3b51..644bb714ef2cf7bba33fe56c14a401ea26ed7b79 100644 (file)
@@ -836,6 +836,9 @@ int imap_read_literal(FILE *fp, struct ImapAccountData *adata,
  */
 void imap_expunge_mailbox(struct ImapAccountData *adata)
 {
+  if (!adata || !adata->mailbox)
+    return;
+
   struct Email *e = NULL;
   int cacheno;
   short old_sort;
index 1544786466016b8d46587f8de45014dc52795352..d3a33f15d3969f7089ddd3b85b46048e17699c54 100644 (file)
@@ -116,10 +116,10 @@ static struct MboxAccountData *mbox_adata_get(struct Mailbox *m)
  */
 static int init_mailbox(struct Mailbox *m)
 {
-  if (!m || (m->magic != MUTT_MBOX))
+  if (!m || (m->magic != MUTT_MBOX) || !m->account)
     return -1;
 
-  if (m->account && m->account->adata)
+  if (m->account->adata)
     return 0;
 
   m->account->adata = mbox_adata_new();
index 4abd1fe6a7d80e3bb130299985b5951b1176d8e6..e4ed2c2b08747a8b18f0cf07e06e37b8bdc4518f 100644 (file)
@@ -91,7 +91,7 @@ bool mutt_ts_capability(void)
       return true;
   }
 
-  /* not supported */
+  /* not reached */
   return false;
 }