From 96700c374e7b6d762fa69fd26554211d69535dbb Mon Sep 17 00:00:00 2001 From: Ralph Corderoy Date: Tue, 12 Sep 2017 00:06:35 +0100 Subject: [PATCH] mhfixmsg.c: Fix memory leaks of boundary string on early returns. --- uip/mhfixmsg.c | 14 ++++++++------ 1 file changed, 8 insertions(+), 6 deletions(-) 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; } -- 2.56.0