unittests: clean up memory for fast.log tests

pull/14025/head
Victor Julien 10 months ago committed by Victor Julien
parent 4fb6dec8a2
commit b85cd8030f

@ -285,9 +285,9 @@ static int AlertFastLogTest01(void)
DetectEngineCtx *de_ctx = DetectEngineCtxInit(); DetectEngineCtx *de_ctx = DetectEngineCtxInit();
FAIL_IF(de_ctx == NULL); FAIL_IF(de_ctx == NULL);
de_ctx->flags |= DE_QUIET; de_ctx->flags |= DE_QUIET;
SCClassConfDeInitContext(de_ctx);
FILE *fd = SCClassConfGenerateValidDummyClassConfigFD01(); FILE *fd = SCClassConfGenerateValidDummyClassConfigFD01();
SCClassConfLoadClassificationConfigFile(de_ctx, fd); SCClassConfLoadClassificationConfigFile(de_ctx, fd);
@ -302,12 +302,10 @@ static int AlertFastLogTest01(void)
FAIL_IF_NOT(p->alerts.cnt == 1); FAIL_IF_NOT(p->alerts.cnt == 1);
FAIL_IF_NOT(strcmp(p->alerts.alerts[0].s->class_msg, "Unknown are we") == 0); FAIL_IF_NOT(strcmp(p->alerts.alerts[0].s->class_msg, "Unknown are we") == 0);
SigGroupCleanup(de_ctx); UTHFreePackets(&p, 1);
SigCleanSignatures(de_ctx);
DetectEngineThreadCtxDeinit(&th_v, (void *)det_ctx); DetectEngineThreadCtxDeinit(&th_v, (void *)det_ctx);
DetectEngineCtxFree(de_ctx); DetectEngineCtxFree(de_ctx);
StatsThreadCleanup(&th_v);
UTHFreePackets(&p, 1);
PASS; PASS;
} }
@ -326,9 +324,9 @@ static int AlertFastLogTest02(void)
DetectEngineCtx *de_ctx = DetectEngineCtxInit(); DetectEngineCtx *de_ctx = DetectEngineCtxInit();
FAIL_IF(de_ctx == NULL); FAIL_IF(de_ctx == NULL);
de_ctx->flags |= DE_QUIET; de_ctx->flags |= DE_QUIET;
SCClassConfDeInitContext(de_ctx);
FILE *fd = SCClassConfGenerateValidDummyClassConfigFD01(); FILE *fd = SCClassConfGenerateValidDummyClassConfigFD01();
SCClassConfLoadClassificationConfigFile(de_ctx, fd); SCClassConfLoadClassificationConfigFile(de_ctx, fd);
@ -343,12 +341,10 @@ static int AlertFastLogTest02(void)
FAIL_IF_NOT(p->alerts.cnt == 1); FAIL_IF_NOT(p->alerts.cnt == 1);
FAIL_IF_NOT(strcmp(p->alerts.alerts[0].s->class_msg, "Unknown are we") == 0); FAIL_IF_NOT(strcmp(p->alerts.alerts[0].s->class_msg, "Unknown are we") == 0);
SigGroupCleanup(de_ctx); UTHFreePackets(&p, 1);
SigCleanSignatures(de_ctx);
DetectEngineThreadCtxDeinit(&th_v, (void *)det_ctx); DetectEngineThreadCtxDeinit(&th_v, (void *)det_ctx);
DetectEngineCtxFree(de_ctx); DetectEngineCtxFree(de_ctx);
StatsThreadCleanup(&th_v);
UTHFreePackets(&p, 1);
PASS; PASS;
} }
@ -359,12 +355,8 @@ static int AlertFastLogTest02(void)
*/ */
void AlertFastLogRegisterTests(void) void AlertFastLogRegisterTests(void)
{ {
#ifdef UNITTESTS #ifdef UNITTESTS
UtRegisterTest("AlertFastLogTest01", AlertFastLogTest01); UtRegisterTest("AlertFastLogTest01", AlertFastLogTest01);
UtRegisterTest("AlertFastLogTest02", AlertFastLogTest02); UtRegisterTest("AlertFastLogTest02", AlertFastLogTest02);
#endif /* UNITTESTS */ #endif /* UNITTESTS */
} }

Loading…
Cancel
Save