From: Philippe Antoine Date: Fri, 11 Oct 2019 08:11:56 +0000 (+0200) Subject: signature: leak fix in DetectAddressParse2 X-Git-Tag: suricata-5.0.1~124 X-Git-Url: http://git.ipfire.org/cgi-bin/gitweb.cgi?a=commitdiff_plain;h=989a6461b0f4d77a85bc4b64b355eafe7d7d36f2;p=thirdparty%2Fsuricata.git signature: leak fix in DetectAddressParse2 --- diff --git a/src/detect-engine-address.c b/src/detect-engine-address.c index 682d864721..f6732dd64c 100644 --- a/src/detect-engine-address.c +++ b/src/detect-engine-address.c @@ -911,8 +911,12 @@ static int DetectAddressParse2(const DetectEngineCtx *de_ctx, DetectAddressPrint(tmp_ad); } #endif - if (DetectAddressMergeNot(&tmp_gh, &tmp_ghn) < 0) + if (DetectAddressMergeNot(&tmp_gh, &tmp_ghn) < 0) { + DetectAddressHeadCleanup(&tmp_ghn); + DetectAddressHeadCleanup(&tmp_gh); goto error; + } + DetectAddressHeadCleanup(&tmp_ghn); SCLogDebug("merged succesfully"); @@ -922,6 +926,7 @@ static int DetectAddressParse2(const DetectEngineCtx *de_ctx, tmp_ad2 = DetectAddressCopy(tmp_ad); if (tmp_ad2 == NULL) { SCLogDebug("DetectAddressCopy failed"); + DetectAddressHeadCleanup(&tmp_gh); goto error; } DetectAddressPrint(tmp_ad2); @@ -934,6 +939,7 @@ static int DetectAddressParse2(const DetectEngineCtx *de_ctx, tmp_ad2 = DetectAddressCopy(tmp_ad); if (tmp_ad2 == NULL) { SCLogDebug("DetectAddressCopy failed"); + DetectAddressHeadCleanup(&tmp_gh); goto error; } DetectAddressPrint(tmp_ad2); @@ -941,7 +947,6 @@ static int DetectAddressParse2(const DetectEngineCtx *de_ctx, } DetectAddressHeadCleanup(&tmp_gh); - DetectAddressHeadCleanup(&tmp_ghn); } n_set = 0; }