X-Git-Url: https://diplodocus.org/git/nmh/blobdiff_plain/d32044516a6b0387e7fdb78b65b879ff8babfda2..8a3954a556cb8ebb4731caa88427f005eec82b16:/uip/mhfixmsg.c?ds=sidebyside diff --git a/uip/mhfixmsg.c b/uip/mhfixmsg.c index 299d24a2..a0c6efda 100644 --- a/uip/mhfixmsg.c +++ b/uip/mhfixmsg.c @@ -406,7 +406,7 @@ main (int argc, char **argv) { if (! folder) { folder = getfolder (1); } - maildir = m_maildir (folder); + maildir = mh_xstrdup(m_maildir (folder)); /* chdir so that error messages, esp. from MIME parser, just refer to the message and not its path. */ @@ -505,6 +505,7 @@ main (int argc, char **argv) { status = 1; } + mh_xfree(maildir); free (cts); if (fx.fixtypes != NULL) { svector_free (fx.fixtypes); } @@ -547,6 +548,7 @@ mhfixmsgsbr (CT *ctp, char *maildir, const fix_transformations *fx, if ((*ctp)->c_file) { char *tempfile; + /* outfp will be closed by the caller */ if ((tempfile = m_mktemp2 (NULL, invo_name, NULL, outfp)) == NULL) { adios (NULL, "unable to create temporary file in %s", @@ -1489,6 +1491,7 @@ build_text_plain_part (CT encoded_part) { be unlinked by free_content (). */ char *tempfile; + /* This m_mktemp2() call closes the temp file. */ if ((tempfile = m_mktemp2 (NULL, invo_name, NULL, NULL)) == NULL) { advise (NULL, "unable to create temporary file in %s", get_temp_dir()); @@ -1627,6 +1630,9 @@ decode_part (CT ct) { status = output_message_fp (ct, file, tmp_decoded); (void) m_unlink (tmp_decoded); free (tmp_decoded); + if (fclose (file)) { + admonish (NULL, "unable to close temporary file %s", tempfile); + } return status; } @@ -2584,7 +2590,7 @@ static int fix_filename_param (char *name, char *value, PM *first_pm, PM *last_pm) { int fixed = 0; - if (HasPrefix(value, "=?") && HasSuffix(value, "?=")) { + if (has_prefix(value, "=?") && has_suffix(value, "?=")) { /* Looks like an RFC 2047 encoded parameter. */ char decoded[PATH_MAX + 1];