From: Victor Julien Date: Mon, 12 Oct 2015 18:05:42 +0000 (+0200) Subject: detect: clean up sgh's at detect engine free X-Git-Tag: suricata-3.1RC1~344 X-Git-Url: http://git.ipfire.org/cgi-bin/gitweb.cgi?a=commitdiff_plain;h=e6248b0dbe849274871a7291019ad337fba90e02;p=thirdparty%2Fsuricata.git detect: clean up sgh's at detect engine free --- diff --git a/src/detect.c b/src/detect.c index 64c14025be..475bbbb5a4 100644 --- a/src/detect.c +++ b/src/detect.c @@ -3943,6 +3943,19 @@ int SigAddressCleanupStage1(DetectEngineCtx *de_ctx) de_ctx->flow_gh[f].udp = NULL; } + uint32_t idx; + for (idx = 0; idx < de_ctx->sgh_array_cnt; idx++) { + SigGroupHead *sgh = de_ctx->sgh_array[idx]; + if (sgh == NULL) + continue; + + SCLogDebug("sgh %p", sgh); + SigGroupHeadFree(sgh); + } + SCFree(de_ctx->sgh_array); + de_ctx->sgh_array = NULL; + de_ctx->sgh_array_cnt = 0; + de_ctx->sgh_array_size = 0; IPOnlyDeinit(de_ctx, &de_ctx->io_ctx); @@ -4019,6 +4032,8 @@ int SigAddressPrepareStage4(DetectEngineCtx *de_ctx) if (sgh == NULL) continue; + SCLogDebug("sgh %p", sgh); + SigGroupHeadSetFilemagicFlag(de_ctx, sgh); SigGroupHeadSetFileMd5Flag(de_ctx, sgh); SigGroupHeadSetFilesizeFlag(de_ctx, sgh); @@ -4051,10 +4066,6 @@ int SigAddressPrepareStage4(DetectEngineCtx *de_ctx) SigGroupHeadHashFree(de_ctx); SigGroupHeadDPortHashFree(de_ctx); - SCFree(de_ctx->sgh_array); - de_ctx->sgh_array_cnt = 0; - de_ctx->sgh_array_size = 0; - RulesDumpGrouping(de_ctx); SCReturnInt(0);