]> granicus.if.org Git - neomutt/commitdiff
fix: resource leak - CID 76967
authorRichard Russon <rich@flatcap.org>
Thu, 16 Feb 2017 12:46:47 +0000 (12:46 +0000)
committerRichard Russon <rich@flatcap.org>
Mon, 20 Feb 2017 16:31:02 +0000 (16:31 +0000)
pgp.c

diff --git a/pgp.c b/pgp.c
index ab613631b027da36a92f662e1b19a5995a14007e..a88bf9ffa4521725abbc883b1acb5f256fdd61c8 100644 (file)
--- a/pgp.c
+++ b/pgp.c
@@ -395,6 +395,7 @@ int pgp_application_pgp_handler (BODY *m, STATE *s)
       if ((tmpfp = safe_fopen (tmpfname, "w+")) == NULL)
       {
        mutt_perror (tmpfname);
+        FREE(&gpgcharset);
        return -1;
       }
       
@@ -416,6 +417,7 @@ int pgp_application_pgp_handler (BODY *m, STATE *s)
        if (mutt_strncmp ("Charset: ", buf, 9) == 0)
        {
          size_t l = 0;
+          FREE(&gpgcharset);
          gpgcharset = safe_strdup (buf + 9);
          if ((l = mutt_strlen (gpgcharset)) > 0 && gpgcharset[l-1] == '\n')
            gpgcharset[l-1] = 0;
@@ -435,6 +437,7 @@ int pgp_application_pgp_handler (BODY *m, STATE *s)
        {
          mutt_perror (outfile);
           safe_fclose (&tmpfp);
+          FREE(&gpgcharset);
          return -1;
        }