From: Victor Julien Date: Fri, 11 Mar 2016 08:29:20 +0000 (+0100) Subject: htp: fix boundry error handling (CID 1153934) X-Git-Tag: suricata-3.0.1RC1~28 X-Git-Url: http://git.ipfire.org/cgi-bin/gitweb.cgi?a=commitdiff_plain;h=665cafbe3bb07683700bad68ba7f2c85a47da1c4;p=thirdparty%2Fsuricata.git htp: fix boundry error handling (CID 1153934) --- diff --git a/src/app-layer-htp.c b/src/app-layer-htp.c index 384dbeea31..008aeff4c8 100644 --- a/src/app-layer-htp.c +++ b/src/app-layer-htp.c @@ -1090,7 +1090,7 @@ static int HtpRequestBodySetupBoundary(HtpTxUserData *htud, uint8_t eb_len = htud->boundary_len + 2; eb = (uint8_t *)HTPMalloc(eb_len); if (eb == NULL) { - goto error; + SCReturnInt(-1); } memset(eb, '-', eb_len); memcpy(eb + 2, htud->boundary, htud->boundary_len); @@ -1098,7 +1098,8 @@ static int HtpRequestBodySetupBoundary(HtpTxUserData *htud, uint8_t ebe_len = htud->boundary_len + 4; ebe = (uint8_t *)HTPMalloc(ebe_len); if (ebe == NULL) { - goto error; + HTPFree(eb, eb_len); + SCReturnInt(-1); } memset(ebe, '-', ebe_len); memcpy(ebe + 2, htud->boundary, htud->boundary_len); @@ -1109,15 +1110,6 @@ static int HtpRequestBodySetupBoundary(HtpTxUserData *htud, *expected_boundary_end_len = ebe_len; SCReturnInt(0); - -error: - if (eb != NULL) { - HTPFree(eb, eb_len); - } - if (ebe != NULL) { - HTPFree(ebe, ebe_len); - } - SCReturnInt(-1); } #define C_D_HDR "content-disposition:"