From 989a6461b0f4d77a85bc4b64b355eafe7d7d36f2 Mon Sep 17 00:00:00 2001 From: Philippe Antoine Date: Fri, 11 Oct 2019 10:11:56 +0200 Subject: [PATCH] signature: leak fix in DetectAddressParse2 --- src/detect-engine-address.c | 9 +++++++-- 1 file changed, 7 insertions(+), 2 deletions(-) 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; } -- 2.47.2