]> granicus.if.org Git - neomutt/commitdiff
fix coverity defects
authorRichard Russon <rich@flatcap.org>
Thu, 10 May 2018 11:57:48 +0000 (12:57 +0100)
committerRichard Russon <rich@flatcap.org>
Thu, 10 May 2018 12:17:59 +0000 (13:17 +0100)
handler.c
hcache/hcache.c
init.c
mutt/charset.c

index 077a962024ddaf109517df195974087d3244cefc..cef5784b1388f7fe3b125967a00c60c1ea8d8e8b 100644 (file)
--- a/handler.c
+++ b/handler.c
@@ -1270,6 +1270,7 @@ static int multilingual_handler(struct Body *a, struct State *s)
   if (mustfree)
     mutt_body_free(&a);
 
+  FREE(&preferred_languages);
   return rc;
 }
 
index 1fedd5ade4a37a090685ce49f4b887ef281d0a9e..99d2a63eebc36e8c0bfc82e74016f662bcccc1be 100644 (file)
@@ -225,8 +225,7 @@ static unsigned char *dump_char_size(char *c, unsigned char *d, int *off,
     p = mutt_str_substr_dup(c, c + size);
     if (mutt_ch_convert_string(&p, Charset, "utf-8", 0) == 0)
     {
-      c = p;
-      size = mutt_str_strlen(c) + 1;
+      size = mutt_str_strlen(p) + 1;
     }
   }
 
@@ -279,7 +278,8 @@ static void restore_char(char **c, const unsigned char *d, int *off, bool conver
     char *tmp = mutt_str_strdup(*c);
     if (mutt_ch_convert_string(&tmp, "utf-8", Charset, 0) == 0)
     {
-      mutt_str_replace(c, tmp);
+      FREE(c);
+      *c = tmp;
     }
     else
     {
diff --git a/init.c b/init.c
index 96ae1886cb8e0e1c01336a3b5e18afac6ddf6155..a24298670280853be73e69821c9d70d43e70de9d 100644 (file)
--- a/init.c
+++ b/init.c
@@ -2827,7 +2827,7 @@ static int parse_set(struct Buffer *buf, struct Buffer *s, unsigned long data,
 #endif
     else
     {
-      snprintf(err->data, err->dsize, _("%s: unknown type"), MuttVars[idx].name);
+      snprintf(err->data, err->dsize, _("%s: unknown type"), (idx >= 0) ? MuttVars[idx].name : "unknown");
       r = -1;
       break;
     }
index ec85bf3db561630873dd5e278ea2ec61595625a0..32994775a05ca5143da85cb0063cd8658c205dd8 100644 (file)
@@ -289,6 +289,7 @@ int mutt_ch_convert_nonmime_string(char **ps)
     s = mutt_str_substr_dup(u, u + ulen);
     int m = mutt_ch_convert_string(&s, fromcode, Charset, 0);
     FREE(&fromcode);
+    FREE(&s);
     if (m == 0)
     {
       return 0;