From: Ralph Corderoy Date: Mon, 11 Sep 2017 23:06:35 +0000 (+0100) Subject: mhfixmsg.c: Fix memory leaks of boundary string on early returns. X-Git-Url: https://diplodocus.org/git/nmh/commitdiff_plain/96700c374e7b6d762fa69fd26554211d69535dbb?hp=92c3b05ef3e582d64b3cecfc261fdd66ef13a4ef mhfixmsg.c: Fix memory leaks of boundary string on early returns. --- diff --git a/uip/mhfixmsg.c b/uip/mhfixmsg.c index cab759a4..6a7a048e 100644 --- a/uip/mhfixmsg.c +++ b/uip/mhfixmsg.c @@ -1742,8 +1742,7 @@ build_multipart_alt (CT first_alt, CT new_part, int type, int subtype) { boundary_in_content (&new_part->c_cefile.ce_fp, new_part->c_cefile.ce_file, boundary)) == NOTOK) { - free_content (ct); - return NULL; + goto return_null; } } @@ -1754,8 +1753,7 @@ build_multipart_alt (CT first_alt, CT new_part, int type, int subtype) { boundary_in_content (&new_part->c_fp, new_part->c_file, boundary)) == NOTOK) { - free_content (ct); - return NULL; + goto return_null; } } @@ -1775,8 +1773,7 @@ build_multipart_alt (CT first_alt, CT new_part, int type, int subtype) { if (found_boundary) { inform("giving up trying to find a unique boundary"); - free_content (ct); - return NULL; + goto return_null; } } @@ -1821,6 +1818,11 @@ build_multipart_alt (CT first_alt, CT new_part, int type, int subtype) { free (boundary); return ct; + +return_null: + free_content(ct); + free(boundary); + return NULL; }