]> granicus.if.org Git - neomutt/commitdiff
coverity: fix leaks
authorRichard Russon <rich@flatcap.org>
Wed, 5 Apr 2017 14:51:30 +0000 (15:51 +0100)
committerRichard Russon <rich@flatcap.org>
Mon, 10 Apr 2017 13:32:13 +0000 (14:32 +0100)
Fix resource leaks.

rfc2231.c
smime.c

index 6fef151ae923edcc63af64a4f6fce2938994b5a2..c0017e926a250793342238a543125348b1497303 100644 (file)
--- a/rfc2231.c
+++ b/rfc2231.c
@@ -318,6 +318,7 @@ int rfc2231_encode_string (char **pd)
                                  *pd, strlen (*pd), &d, &dlen)))
   {
     charset = safe_strdup (Charset ? Charset : "unknown-8bit");
+    FREE(&d);
     d = *pd;
     dlen = strlen (d);
   }
diff --git a/smime.c b/smime.c
index d081e61252a6dc9988149f72d0ee3a863440779f..f300217875e4339e72c5ec38d8759fb23fd68a15 100644 (file)
--- a/smime.c
+++ b/smime.c
@@ -1221,7 +1221,14 @@ void smime_invoke_import (char *infile, char *mailbox)
 
   buf[0] = '\0';
   if (option (OPTASKCERTLABEL))
-    mutt_get_field (_("Label for certificate: "), buf, sizeof (buf), 0);
+  {
+    if ((mutt_get_field (_("Label for certificate: "), buf, sizeof (buf), 0) != 0) || (buf[0] == 0))
+    {
+      safe_fclose (&fpout);
+      safe_fclose (&fperr);
+      return;
+    }
+  }
 
   mutt_endwin (NULL);
   if ((certfile = smime_extract_certificate(infile)))