From: David Levine Date: Sun, 6 Nov 2016 22:41:01 +0000 (-0500) Subject: Plugged remaining mhfixmsg(1) memory leaks. X-Git-Url: https://diplodocus.org/git/nmh/commitdiff_plain/8e3bad4aa3278e80fc82f50e75800c37ef018bf0 Plugged remaining mhfixmsg(1) memory leaks. --- diff --git a/uip/mhfixmsg.c b/uip/mhfixmsg.c index b7f1917a..f781382e 100644 --- a/uip/mhfixmsg.c +++ b/uip/mhfixmsg.c @@ -472,12 +472,12 @@ main (int argc, char **argv) { } } } - - free (cts); } else { status = 1; } + free (cts); + if (fx.fixtypes != NULL) { svector_free (fx.fixtypes); } free (outfile); free (file); @@ -1292,6 +1292,7 @@ ensure_text_plain (CT *ct, CT parent, int *message_mods, int replacetextplain) { HF hf; parent->c_subtype = MULTI_ALTERNATE; + free (parent->c_ctinfo.ci_subtype); parent->c_ctinfo.ci_subtype = mh_xstrdup("alternative"); if (! replace_substring (&parent->c_ctline, "/related", "/alternative")) { @@ -1710,8 +1711,8 @@ build_multipart_alt (CT first_alt, CT new_part, int type, int subtype) { if ((found_boundary = boundary_in_content (&new_part->c_cefile.ce_fp, new_part->c_cefile.ce_file, - boundary)) == -1) { - free (ct); + boundary)) == NOTOK) { + free_content (ct); return NULL; } } @@ -1719,10 +1720,11 @@ build_multipart_alt (CT first_alt, CT new_part, int type, int subtype) { /* Ensure that the boundary doesn't appear in the encoded content. */ if (! found_boundary && new_part->c_file) { - if ((found_boundary = boundary_in_content (&new_part->c_fp, - new_part->c_file, - boundary)) == -1) { - free (ct); + if ((found_boundary = + boundary_in_content (&new_part->c_fp, + new_part->c_file, + boundary)) == NOTOK) { + free_content (ct); return NULL; } } @@ -1743,7 +1745,7 @@ build_multipart_alt (CT first_alt, CT new_part, int type, int subtype) { if (found_boundary) { advise (NULL, "giving up trying to find a unique boundary"); - free (ct); + free_content (ct); return NULL; } }