From: Richard Russon Date: Wed, 5 Apr 2017 14:51:30 +0000 (+0100) Subject: coverity: fix leaks X-Git-Tag: neomutt-20170414~10^2~1 X-Git-Url: https://granicus.if.org/sourcecode?a=commitdiff_plain;h=e65462db5fbcfcd8241a0f726a4fc37577cb00d9;p=neomutt coverity: fix leaks Fix resource leaks. --- diff --git a/rfc2231.c b/rfc2231.c index 6fef151ae..c0017e926 100644 --- 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 d081e6125..f30021787 100644 --- 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)))