fix: resource leak - CID 76984
authorRichard Russon <rich@flatcap.org>
Thu, 16 Feb 2017 12:43:39 +0000 (12:43 +0000)
committerRichard Russon <rich@flatcap.org>
Mon, 20 Feb 2017 16:31:03 +0000 (16:31 +0000)
edit.c

diff --git a/edit.c b/edit.c
index df6ae460f9096720ec25c6f8933b8997818e589e..38e1b542fa96a67b4cd1f791648754df3009a639 100644 (file)
--- a/edit.c
+++ b/edit.c
@@ -441,7 +441,7 @@ int mutt_builtin_editor (const char *path, HEADER *msg, HEADER *cur)
        case 'v':
          if (be_barf_file (path, buf, buflen) == 0)
          {
-           char *tag, *err;
+            char *tag = NULL, *err = NULL;
            be_free_memory (buf, buflen);
            buf = NULL;
            bufmax = buflen = 0;
@@ -452,6 +452,8 @@ int mutt_builtin_editor (const char *path, HEADER *msg, HEADER *cur)
              mutt_edit_headers (NONULL(Visual), path, msg, NULL, 0);
              if (mutt_env_to_intl (msg->env, &tag, &err))
                printw (_("Bad IDN in %s: '%s'\n"), tag, err);
+              /* tag is a statically allocated string and should not be freed */
+              FREE(&err);
            }
            else
              mutt_edit_file (NONULL(Visual), path);