detect/http-server-body: code cleanup and test cleanups

pull/3632/head
Victor Julien 6 years ago
parent 3413757027
commit 58aa9dca65

@ -201,13 +201,11 @@ static int RunTest(struct TestSteps *steps, const char *sig, const char *yaml)
{ {
TcpSession ssn; TcpSession ssn;
Flow f; Flow f;
Packet *p = NULL;
ThreadVars th_v; ThreadVars th_v;
DetectEngineCtx *de_ctx = NULL;
DetectEngineThreadCtx *det_ctx = NULL; DetectEngineThreadCtx *det_ctx = NULL;
int result = 0;
int i = 0;
AppLayerParserThreadCtx *alp_tctx = AppLayerParserThreadCtxAlloc(); AppLayerParserThreadCtx *alp_tctx = AppLayerParserThreadCtxAlloc();
FAIL_IF_NULL(alp_tctx);
memset(&th_v, 0, sizeof(th_v)); memset(&th_v, 0, sizeof(th_v));
memset(&f, 0, sizeof(f)); memset(&f, 0, sizeof(f));
memset(&ssn, 0, sizeof(ssn)); memset(&ssn, 0, sizeof(ssn));
@ -224,9 +222,9 @@ static int RunTest(struct TestSteps *steps, const char *sig, const char *yaml)
StreamTcpInitConfig(TRUE); StreamTcpInitConfig(TRUE);
de_ctx = DetectEngineCtxInit(); DetectEngineCtx *de_ctx = DetectEngineCtxInit();
if (de_ctx == NULL) FAIL_IF_NULL(de_ctx);
goto end; de_ctx->flags |= DE_QUIET;
FLOW_INITIALIZE(&f); FLOW_INITIALIZE(&f);
f.protoctx = (void *)&ssn; f.protoctx = (void *)&ssn;
@ -235,76 +233,53 @@ static int RunTest(struct TestSteps *steps, const char *sig, const char *yaml)
f.alproto = ALPROTO_HTTP; f.alproto = ALPROTO_HTTP;
SCLogDebug("sig %s", sig); SCLogDebug("sig %s", sig);
DetectEngineAppendSig(de_ctx, (char *)sig); Signature *s = DetectEngineAppendSig(de_ctx, (char *)sig);
FAIL_IF_NULL(s);
de_ctx->flags |= DE_QUIET;
if (de_ctx->sig_list == NULL)
goto end;
SigGroupBuild(de_ctx); SigGroupBuild(de_ctx);
DetectEngineThreadCtxInit(&th_v, (void *)de_ctx, (void *)&det_ctx); DetectEngineThreadCtxInit(&th_v, (void *)de_ctx, (void *)&det_ctx);
FAIL_IF_NULL(det_ctx);
struct TestSteps *b = steps; struct TestSteps *b = steps;
i = 0; int i = 0;
while (b->input != NULL) { while (b->input != NULL) {
SCLogDebug("chunk %p %d", b, i); SCLogDebug("chunk %p %d", b, i);
p = UTHBuildPacket(NULL, 0, IPPROTO_TCP); Packet *p = UTHBuildPacket(NULL, 0, IPPROTO_TCP);
if (p == NULL) FAIL_IF_NULL(p);
goto end;
p->flow = &f; p->flow = &f;
p->flowflags = (b->direction == STREAM_TOSERVER) ? FLOW_PKT_TOSERVER : FLOW_PKT_TOCLIENT; p->flowflags = (b->direction == STREAM_TOSERVER) ? FLOW_PKT_TOSERVER : FLOW_PKT_TOCLIENT;
p->flowflags |= FLOW_PKT_ESTABLISHED; p->flowflags |= FLOW_PKT_ESTABLISHED;
p->flags |= PKT_HAS_FLOW|PKT_STREAM_EST; p->flags |= PKT_HAS_FLOW|PKT_STREAM_EST;
FLOWLOCK_WRLOCK(&f);
int r = AppLayerParserParse(NULL, alp_tctx, &f, ALPROTO_HTTP, int r = AppLayerParserParse(NULL, alp_tctx, &f, ALPROTO_HTTP,
b->direction, (uint8_t *)b->input, b->direction, (uint8_t *)b->input,
b->input_size ? b->input_size : strlen((const char *)b->input)); b->input_size ? b->input_size : strlen((const char *)b->input));
if (r != 0) { FAIL_IF_NOT(r == 0);
printf("toserver chunk %d returned %" PRId32 ", expected 0: ", i+1, r);
result = 0;
FLOWLOCK_UNLOCK(&f);
goto end;
}
FLOWLOCK_UNLOCK(&f);
/* do detect */ /* do detect */
SigMatchSignatures(&th_v, de_ctx, det_ctx, p); SigMatchSignatures(&th_v, de_ctx, det_ctx, p);
int match = PacketAlertCheck(p, 1); int match = PacketAlertCheck(p, 1);
if (b->expect != match) { FAIL_IF_NOT(b->expect == match);
printf("rule matching mismatch: ");
goto end;
}
UTHFreePackets(&p, 1); UTHFreePackets(&p, 1);
p = NULL;
b++; b++;
i++; i++;
} }
result = 1;
end: DetectEngineThreadCtxDeinit(&th_v, (void *)det_ctx);
if (alp_tctx != NULL) AppLayerParserThreadCtxFree(alp_tctx);
AppLayerParserThreadCtxFree(alp_tctx); DetectEngineCtxFree(de_ctx);
if (de_ctx != NULL)
SigGroupCleanup(de_ctx);
if (de_ctx != NULL)
SigCleanSignatures(de_ctx);
if (de_ctx != NULL)
DetectEngineCtxFree(de_ctx);
StreamTcpFreeConfig(TRUE); StreamTcpFreeConfig(TRUE);
FLOW_DESTROY(&f); FLOW_DESTROY(&f);
UTHFreePackets(&p, 1);
if (yaml) { if (yaml) {
HtpConfigRestoreBackup(); HtpConfigRestoreBackup();
ConfRestoreContextBackup(); ConfRestoreContextBackup();
EngineModeSetIDS(); EngineModeSetIDS();
} }
return result; PASS;
} }
static int DetectEngineHttpServerBodyTest01(void) static int DetectEngineHttpServerBodyTest01(void)
@ -423,10 +398,6 @@ static int DetectEngineHttpServerBodyTest01(void)
end: end:
if (alp_tctx != NULL) if (alp_tctx != NULL)
AppLayerParserThreadCtxFree(alp_tctx); AppLayerParserThreadCtxFree(alp_tctx);
if (de_ctx != NULL)
SigGroupCleanup(de_ctx);
if (de_ctx != NULL)
SigCleanSignatures(de_ctx);
if (de_ctx != NULL) if (de_ctx != NULL)
DetectEngineCtxFree(de_ctx); DetectEngineCtxFree(de_ctx);
@ -539,10 +510,6 @@ static int DetectEngineHttpServerBodyTest02(void)
end: end:
if (alp_tctx != NULL) if (alp_tctx != NULL)
AppLayerParserThreadCtxFree(alp_tctx); AppLayerParserThreadCtxFree(alp_tctx);
if (de_ctx != NULL)
SigGroupCleanup(de_ctx);
if (de_ctx != NULL)
SigCleanSignatures(de_ctx);
if (de_ctx != NULL) if (de_ctx != NULL)
DetectEngineCtxFree(de_ctx); DetectEngineCtxFree(de_ctx);
@ -682,10 +649,6 @@ static int DetectEngineHttpServerBodyTest03(void)
end: end:
if (alp_tctx != NULL) if (alp_tctx != NULL)
AppLayerParserThreadCtxFree(alp_tctx); AppLayerParserThreadCtxFree(alp_tctx);
if (de_ctx != NULL)
SigGroupCleanup(de_ctx);
if (de_ctx != NULL)
SigCleanSignatures(de_ctx);
if (de_ctx != NULL) if (de_ctx != NULL)
DetectEngineCtxFree(de_ctx); DetectEngineCtxFree(de_ctx);
@ -812,10 +775,6 @@ static int DetectEngineHttpServerBodyTest04(void)
end: end:
if (alp_tctx != NULL) if (alp_tctx != NULL)
AppLayerParserThreadCtxFree(alp_tctx); AppLayerParserThreadCtxFree(alp_tctx);
if (de_ctx != NULL)
SigGroupCleanup(de_ctx);
if (de_ctx != NULL)
SigCleanSignatures(de_ctx);
if (de_ctx != NULL) if (de_ctx != NULL)
DetectEngineCtxFree(de_ctx); DetectEngineCtxFree(de_ctx);
@ -942,10 +901,6 @@ static int DetectEngineHttpServerBodyTest05(void)
end: end:
if (alp_tctx != NULL) if (alp_tctx != NULL)
AppLayerParserThreadCtxFree(alp_tctx); AppLayerParserThreadCtxFree(alp_tctx);
if (de_ctx != NULL)
SigGroupCleanup(de_ctx);
if (de_ctx != NULL)
SigCleanSignatures(de_ctx);
if (de_ctx != NULL) if (de_ctx != NULL)
DetectEngineCtxFree(de_ctx); DetectEngineCtxFree(de_ctx);
@ -1072,10 +1027,6 @@ static int DetectEngineHttpServerBodyTest06(void)
end: end:
if (alp_tctx != NULL) if (alp_tctx != NULL)
AppLayerParserThreadCtxFree(alp_tctx); AppLayerParserThreadCtxFree(alp_tctx);
if (de_ctx != NULL)
SigGroupCleanup(de_ctx);
if (de_ctx != NULL)
SigCleanSignatures(de_ctx);
if (de_ctx != NULL) if (de_ctx != NULL)
DetectEngineCtxFree(de_ctx); DetectEngineCtxFree(de_ctx);
@ -1202,10 +1153,6 @@ static int DetectEngineHttpServerBodyTest07(void)
end: end:
if (alp_tctx != NULL) if (alp_tctx != NULL)
AppLayerParserThreadCtxFree(alp_tctx); AppLayerParserThreadCtxFree(alp_tctx);
if (de_ctx != NULL)
SigGroupCleanup(de_ctx);
if (de_ctx != NULL)
SigCleanSignatures(de_ctx);
if (de_ctx != NULL) if (de_ctx != NULL)
DetectEngineCtxFree(de_ctx); DetectEngineCtxFree(de_ctx);
@ -1332,10 +1279,6 @@ static int DetectEngineHttpServerBodyTest08(void)
end: end:
if (alp_tctx != NULL) if (alp_tctx != NULL)
AppLayerParserThreadCtxFree(alp_tctx); AppLayerParserThreadCtxFree(alp_tctx);
if (de_ctx != NULL)
SigGroupCleanup(de_ctx);
if (de_ctx != NULL)
SigCleanSignatures(de_ctx);
if (de_ctx != NULL) if (de_ctx != NULL)
DetectEngineCtxFree(de_ctx); DetectEngineCtxFree(de_ctx);
@ -1463,10 +1406,6 @@ static int DetectEngineHttpServerBodyTest09(void)
end: end:
if (alp_tctx != NULL) if (alp_tctx != NULL)
AppLayerParserThreadCtxFree(alp_tctx); AppLayerParserThreadCtxFree(alp_tctx);
if (de_ctx != NULL)
SigGroupCleanup(de_ctx);
if (de_ctx != NULL)
SigCleanSignatures(de_ctx);
if (de_ctx != NULL) if (de_ctx != NULL)
DetectEngineCtxFree(de_ctx); DetectEngineCtxFree(de_ctx);
@ -1594,10 +1533,6 @@ static int DetectEngineHttpServerBodyTest10(void)
end: end:
if (alp_tctx != NULL) if (alp_tctx != NULL)
AppLayerParserThreadCtxFree(alp_tctx); AppLayerParserThreadCtxFree(alp_tctx);
if (de_ctx != NULL)
SigGroupCleanup(de_ctx);
if (de_ctx != NULL)
SigCleanSignatures(de_ctx);
if (de_ctx != NULL) if (de_ctx != NULL)
DetectEngineCtxFree(de_ctx); DetectEngineCtxFree(de_ctx);
@ -1725,10 +1660,6 @@ static int DetectEngineHttpServerBodyTest11(void)
end: end:
if (alp_tctx != NULL) if (alp_tctx != NULL)
AppLayerParserThreadCtxFree(alp_tctx); AppLayerParserThreadCtxFree(alp_tctx);
if (de_ctx != NULL)
SigGroupCleanup(de_ctx);
if (de_ctx != NULL)
SigCleanSignatures(de_ctx);
if (de_ctx != NULL) if (de_ctx != NULL)
DetectEngineCtxFree(de_ctx); DetectEngineCtxFree(de_ctx);
@ -1856,10 +1787,6 @@ static int DetectEngineHttpServerBodyTest12(void)
end: end:
if (alp_tctx != NULL) if (alp_tctx != NULL)
AppLayerParserThreadCtxFree(alp_tctx); AppLayerParserThreadCtxFree(alp_tctx);
if (de_ctx != NULL)
SigGroupCleanup(de_ctx);
if (de_ctx != NULL)
SigCleanSignatures(de_ctx);
if (de_ctx != NULL) if (de_ctx != NULL)
DetectEngineCtxFree(de_ctx); DetectEngineCtxFree(de_ctx);
@ -1987,10 +1914,6 @@ static int DetectEngineHttpServerBodyTest13(void)
end: end:
if (alp_tctx != NULL) if (alp_tctx != NULL)
AppLayerParserThreadCtxFree(alp_tctx); AppLayerParserThreadCtxFree(alp_tctx);
if (de_ctx != NULL)
SigGroupCleanup(de_ctx);
if (de_ctx != NULL)
SigCleanSignatures(de_ctx);
if (de_ctx != NULL) if (de_ctx != NULL)
DetectEngineCtxFree(de_ctx); DetectEngineCtxFree(de_ctx);
@ -2118,10 +2041,6 @@ static int DetectEngineHttpServerBodyTest14(void)
end: end:
if (alp_tctx != NULL) if (alp_tctx != NULL)
AppLayerParserThreadCtxFree(alp_tctx); AppLayerParserThreadCtxFree(alp_tctx);
if (de_ctx != NULL)
SigGroupCleanup(de_ctx);
if (de_ctx != NULL)
SigCleanSignatures(de_ctx);
if (de_ctx != NULL) if (de_ctx != NULL)
DetectEngineCtxFree(de_ctx); DetectEngineCtxFree(de_ctx);
@ -2249,10 +2168,6 @@ static int DetectEngineHttpServerBodyTest15(void)
end: end:
if (alp_tctx != NULL) if (alp_tctx != NULL)
AppLayerParserThreadCtxFree(alp_tctx); AppLayerParserThreadCtxFree(alp_tctx);
if (de_ctx != NULL)
SigGroupCleanup(de_ctx);
if (de_ctx != NULL)
SigCleanSignatures(de_ctx);
if (de_ctx != NULL) if (de_ctx != NULL)
DetectEngineCtxFree(de_ctx); DetectEngineCtxFree(de_ctx);
@ -2428,10 +2343,6 @@ end:
HtpConfigRestoreBackup(); HtpConfigRestoreBackup();
ConfRestoreContextBackup(); ConfRestoreContextBackup();
if (de_ctx != NULL)
SigGroupCleanup(de_ctx);
if (de_ctx != NULL)
SigCleanSignatures(de_ctx);
if (de_ctx != NULL) if (de_ctx != NULL)
DetectEngineCtxFree(de_ctx); DetectEngineCtxFree(de_ctx);
@ -2607,10 +2518,6 @@ end:
HtpConfigRestoreBackup(); HtpConfigRestoreBackup();
ConfRestoreContextBackup(); ConfRestoreContextBackup();
if (de_ctx != NULL)
SigGroupCleanup(de_ctx);
if (de_ctx != NULL)
SigCleanSignatures(de_ctx);
if (de_ctx != NULL) if (de_ctx != NULL)
DetectEngineCtxFree(de_ctx); DetectEngineCtxFree(de_ctx);
@ -2741,10 +2648,6 @@ static int DetectEngineHttpServerBodyTest18(void)
end: end:
if (alp_tctx != NULL) if (alp_tctx != NULL)
AppLayerParserThreadCtxFree(alp_tctx); AppLayerParserThreadCtxFree(alp_tctx);
if (de_ctx != NULL)
SigGroupCleanup(de_ctx);
if (de_ctx != NULL)
SigCleanSignatures(de_ctx);
if (de_ctx != NULL) if (de_ctx != NULL)
DetectEngineCtxFree(de_ctx); DetectEngineCtxFree(de_ctx);
@ -2873,10 +2776,6 @@ static int DetectEngineHttpServerBodyTest19(void)
end: end:
if (alp_tctx != NULL) if (alp_tctx != NULL)
AppLayerParserThreadCtxFree(alp_tctx); AppLayerParserThreadCtxFree(alp_tctx);
if (de_ctx != NULL)
SigGroupCleanup(de_ctx);
if (de_ctx != NULL)
SigCleanSignatures(de_ctx);
if (de_ctx != NULL) if (de_ctx != NULL)
DetectEngineCtxFree(de_ctx); DetectEngineCtxFree(de_ctx);
@ -3004,10 +2903,6 @@ static int DetectEngineHttpServerBodyTest20(void)
end: end:
if (alp_tctx != NULL) if (alp_tctx != NULL)
AppLayerParserThreadCtxFree(alp_tctx); AppLayerParserThreadCtxFree(alp_tctx);
if (de_ctx != NULL)
SigGroupCleanup(de_ctx);
if (de_ctx != NULL)
SigCleanSignatures(de_ctx);
if (de_ctx != NULL) if (de_ctx != NULL)
DetectEngineCtxFree(de_ctx); DetectEngineCtxFree(de_ctx);
@ -3137,10 +3032,6 @@ static int DetectEngineHttpServerBodyTest21(void)
end: end:
if (alp_tctx != NULL) if (alp_tctx != NULL)
AppLayerParserThreadCtxFree(alp_tctx); AppLayerParserThreadCtxFree(alp_tctx);
if (de_ctx != NULL)
SigGroupCleanup(de_ctx);
if (de_ctx != NULL)
SigCleanSignatures(de_ctx);
if (de_ctx != NULL) if (de_ctx != NULL)
DetectEngineCtxFree(de_ctx); DetectEngineCtxFree(de_ctx);
@ -3272,10 +3163,6 @@ static int DetectEngineHttpServerBodyTest22(void)
end: end:
if (alp_tctx != NULL) if (alp_tctx != NULL)
AppLayerParserThreadCtxFree(alp_tctx); AppLayerParserThreadCtxFree(alp_tctx);
if (de_ctx != NULL)
SigGroupCleanup(de_ctx);
if (de_ctx != NULL)
SigCleanSignatures(de_ctx);
if (de_ctx != NULL) if (de_ctx != NULL)
DetectEngineCtxFree(de_ctx); DetectEngineCtxFree(de_ctx);
@ -3403,10 +3290,6 @@ static int DetectEngineHttpServerBodyFileDataTest01(void)
end: end:
if (alp_tctx != NULL) if (alp_tctx != NULL)
AppLayerParserThreadCtxFree(alp_tctx); AppLayerParserThreadCtxFree(alp_tctx);
if (de_ctx != NULL)
SigGroupCleanup(de_ctx);
if (de_ctx != NULL)
SigCleanSignatures(de_ctx);
if (de_ctx != NULL) if (de_ctx != NULL)
DetectEngineCtxFree(de_ctx); DetectEngineCtxFree(de_ctx);
@ -3534,10 +3417,6 @@ static int DetectEngineHttpServerBodyFileDataTest02(void)
end: end:
if (alp_tctx != NULL) if (alp_tctx != NULL)
AppLayerParserThreadCtxFree(alp_tctx); AppLayerParserThreadCtxFree(alp_tctx);
if (de_ctx != NULL)
SigGroupCleanup(de_ctx);
if (de_ctx != NULL)
SigCleanSignatures(de_ctx);
if (de_ctx != NULL) if (de_ctx != NULL)
DetectEngineCtxFree(de_ctx); DetectEngineCtxFree(de_ctx);
@ -3673,10 +3552,6 @@ static int DetectEngineHttpServerBodyFileDataTest03(void)
end: end:
if (alp_tctx != NULL) if (alp_tctx != NULL)
AppLayerParserThreadCtxFree(alp_tctx); AppLayerParserThreadCtxFree(alp_tctx);
if (de_ctx != NULL)
SigGroupCleanup(de_ctx);
if (de_ctx != NULL)
SigCleanSignatures(de_ctx);
if (de_ctx != NULL) if (de_ctx != NULL)
DetectEngineCtxFree(de_ctx); DetectEngineCtxFree(de_ctx);

@ -61,7 +61,6 @@
static int DetectHttpServerBodySetup(DetectEngineCtx *, Signature *, const char *); static int DetectHttpServerBodySetup(DetectEngineCtx *, Signature *, const char *);
static void DetectHttpServerBodyRegisterTests(void); static void DetectHttpServerBodyRegisterTests(void);
static void DetectHttpServerBodyFree(void *);
static int g_file_data_buffer_id = 0; static int g_file_data_buffer_id = 0;
@ -73,11 +72,8 @@ void DetectHttpServerBodyRegister(void)
sigmatch_table[DETECT_AL_HTTP_SERVER_BODY].name = "http_server_body"; sigmatch_table[DETECT_AL_HTTP_SERVER_BODY].name = "http_server_body";
sigmatch_table[DETECT_AL_HTTP_SERVER_BODY].desc = "content modifier to match only on the HTTP response-body"; sigmatch_table[DETECT_AL_HTTP_SERVER_BODY].desc = "content modifier to match only on the HTTP response-body";
sigmatch_table[DETECT_AL_HTTP_SERVER_BODY].url = DOC_URL DOC_VERSION "/rules/http-keywords.html#http-server-body"; sigmatch_table[DETECT_AL_HTTP_SERVER_BODY].url = DOC_URL DOC_VERSION "/rules/http-keywords.html#http-server-body";
sigmatch_table[DETECT_AL_HTTP_SERVER_BODY].Match = NULL;
sigmatch_table[DETECT_AL_HTTP_SERVER_BODY].Setup = DetectHttpServerBodySetup; sigmatch_table[DETECT_AL_HTTP_SERVER_BODY].Setup = DetectHttpServerBodySetup;
sigmatch_table[DETECT_AL_HTTP_SERVER_BODY].Free = DetectHttpServerBodyFree;
sigmatch_table[DETECT_AL_HTTP_SERVER_BODY].RegisterTests = DetectHttpServerBodyRegisterTests; sigmatch_table[DETECT_AL_HTTP_SERVER_BODY].RegisterTests = DetectHttpServerBodyRegisterTests;
sigmatch_table[DETECT_AL_HTTP_SERVER_BODY].flags |= SIGMATCH_NOOPT; sigmatch_table[DETECT_AL_HTTP_SERVER_BODY].flags |= SIGMATCH_NOOPT;
g_file_data_buffer_id = DetectBufferTypeRegister("file_data"); g_file_data_buffer_id = DetectBufferTypeRegister("file_data");
@ -104,27 +100,6 @@ int DetectHttpServerBodySetup(DetectEngineCtx *de_ctx, Signature *s, const char
ALPROTO_HTTP); ALPROTO_HTTP);
} }
/**
* \brief The function to free the http_server_body data.
*
* \param ptr Pointer to the http_server_body.
*/
void DetectHttpServerBodyFree(void *ptr)
{
SCEnter();
DetectContentData *hsbd = (DetectContentData *)ptr;
if (hsbd == NULL)
SCReturn;
if (hsbd->content != NULL)
SCFree(hsbd->content);
SpmDestroyCtx(hsbd->spm_ctx);
SCFree(hsbd);
SCReturn;
}
/************************************Unittests*********************************/ /************************************Unittests*********************************/
#ifdef UNITTESTS #ifdef UNITTESTS
@ -175,8 +150,6 @@ static int DetectHttpServerBodyTest01(void)
result = 1; result = 1;
end: end:
SigGroupCleanup(de_ctx);
SigCleanSignatures(de_ctx);
DetectEngineCtxFree(de_ctx); DetectEngineCtxFree(de_ctx);
return result; return result;
@ -203,8 +176,6 @@ static int DetectHttpServerBodyTest02(void)
result = 1; result = 1;
end: end:
SigGroupCleanup(de_ctx);
SigCleanSignatures(de_ctx);
DetectEngineCtxFree(de_ctx); DetectEngineCtxFree(de_ctx);
return result; return result;
@ -231,8 +202,6 @@ static int DetectHttpServerBodyTest03(void)
result = 1; result = 1;
end: end:
SigGroupCleanup(de_ctx);
SigCleanSignatures(de_ctx);
DetectEngineCtxFree(de_ctx); DetectEngineCtxFree(de_ctx);
return result; return result;
@ -259,8 +228,6 @@ static int DetectHttpServerBodyTest04(void)
result = 1; result = 1;
end: end:
SigGroupCleanup(de_ctx);
SigCleanSignatures(de_ctx);
DetectEngineCtxFree(de_ctx); DetectEngineCtxFree(de_ctx);
return result; return result;
@ -287,8 +254,6 @@ static int DetectHttpServerBodyTest05(void)
result = 1; result = 1;
end: end:
SigGroupCleanup(de_ctx);
SigCleanSignatures(de_ctx);
DetectEngineCtxFree(de_ctx); DetectEngineCtxFree(de_ctx);
return result; return result;
@ -400,10 +365,6 @@ static int DetectHttpServerBodyTest06(void)
end: end:
if (alp_tctx != NULL) if (alp_tctx != NULL)
AppLayerParserThreadCtxFree(alp_tctx); AppLayerParserThreadCtxFree(alp_tctx);
if (de_ctx != NULL)
SigGroupCleanup(de_ctx);
if (de_ctx != NULL)
SigCleanSignatures(de_ctx);
if (de_ctx != NULL) if (de_ctx != NULL)
DetectEngineCtxFree(de_ctx); DetectEngineCtxFree(de_ctx);
@ -544,10 +505,6 @@ static int DetectHttpServerBodyTest07(void)
end: end:
if (alp_tctx != NULL) if (alp_tctx != NULL)
AppLayerParserThreadCtxFree(alp_tctx); AppLayerParserThreadCtxFree(alp_tctx);
if (de_ctx != NULL)
SigGroupCleanup(de_ctx);
if (de_ctx != NULL)
SigCleanSignatures(de_ctx);
if (de_ctx != NULL) if (de_ctx != NULL)
DetectEngineCtxFree(de_ctx); DetectEngineCtxFree(de_ctx);
@ -694,10 +651,6 @@ static int DetectHttpServerBodyTest08(void)
end: end:
if (alp_tctx != NULL) if (alp_tctx != NULL)
AppLayerParserThreadCtxFree(alp_tctx); AppLayerParserThreadCtxFree(alp_tctx);
if (de_ctx != NULL)
SigGroupCleanup(de_ctx);
if (de_ctx != NULL)
SigCleanSignatures(de_ctx);
if (de_ctx != NULL) if (de_ctx != NULL)
DetectEngineCtxFree(de_ctx); DetectEngineCtxFree(de_ctx);
@ -857,10 +810,6 @@ static int DetectHttpServerBodyTest09(void)
end: end:
if (alp_tctx != NULL) if (alp_tctx != NULL)
AppLayerParserThreadCtxFree(alp_tctx); AppLayerParserThreadCtxFree(alp_tctx);
if (de_ctx != NULL)
SigGroupCleanup(de_ctx);
if (de_ctx != NULL)
SigCleanSignatures(de_ctx);
if (de_ctx != NULL) if (de_ctx != NULL)
DetectEngineCtxFree(de_ctx); DetectEngineCtxFree(de_ctx);
@ -1020,10 +969,6 @@ static int DetectHttpServerBodyTest10(void)
end: end:
if (alp_tctx != NULL) if (alp_tctx != NULL)
AppLayerParserThreadCtxFree(alp_tctx); AppLayerParserThreadCtxFree(alp_tctx);
if (de_ctx != NULL)
SigGroupCleanup(de_ctx);
if (de_ctx != NULL)
SigCleanSignatures(de_ctx);
if (de_ctx != NULL) if (de_ctx != NULL)
DetectEngineCtxFree(de_ctx); DetectEngineCtxFree(de_ctx);
@ -1169,10 +1114,6 @@ static int DetectHttpServerBodyTest11(void)
end: end:
if (alp_tctx != NULL) if (alp_tctx != NULL)
AppLayerParserThreadCtxFree(alp_tctx); AppLayerParserThreadCtxFree(alp_tctx);
if (de_ctx != NULL)
SigGroupCleanup(de_ctx);
if (de_ctx != NULL)
SigCleanSignatures(de_ctx);
if (de_ctx != NULL) if (de_ctx != NULL)
DetectEngineCtxFree(de_ctx); DetectEngineCtxFree(de_ctx);
@ -1318,10 +1259,6 @@ static int DetectHttpServerBodyTest12(void)
end: end:
if (alp_tctx != NULL) if (alp_tctx != NULL)
AppLayerParserThreadCtxFree(alp_tctx); AppLayerParserThreadCtxFree(alp_tctx);
if (de_ctx != NULL)
SigGroupCleanup(de_ctx);
if (de_ctx != NULL)
SigCleanSignatures(de_ctx);
if (de_ctx != NULL) if (de_ctx != NULL)
DetectEngineCtxFree(de_ctx); DetectEngineCtxFree(de_ctx);
@ -1434,10 +1371,6 @@ static int DetectHttpServerBodyTest13(void)
end: end:
if (alp_tctx != NULL) if (alp_tctx != NULL)
AppLayerParserThreadCtxFree(alp_tctx); AppLayerParserThreadCtxFree(alp_tctx);
if (de_ctx != NULL)
SigGroupCleanup(de_ctx);
if (de_ctx != NULL)
SigCleanSignatures(de_ctx);
if (de_ctx != NULL) if (de_ctx != NULL)
DetectEngineCtxFree(de_ctx); DetectEngineCtxFree(de_ctx);
@ -1611,7 +1544,6 @@ end:
DetectEngineThreadCtxDeinit(&th_v, (void *)det_ctx); DetectEngineThreadCtxDeinit(&th_v, (void *)det_ctx);
} }
if (de_ctx != NULL) { if (de_ctx != NULL) {
SigGroupCleanup(de_ctx);
DetectEngineCtxFree(de_ctx); DetectEngineCtxFree(de_ctx);
} }
@ -1776,7 +1708,6 @@ end:
DetectEngineThreadCtxDeinit(&th_v, (void *)det_ctx); DetectEngineThreadCtxDeinit(&th_v, (void *)det_ctx);
} }
if (de_ctx != NULL) { if (de_ctx != NULL) {
SigGroupCleanup(de_ctx);
DetectEngineCtxFree(de_ctx); DetectEngineCtxFree(de_ctx);
} }
@ -2671,10 +2602,6 @@ static int DetectHttpServerBodyFileDataTest02(void)
end: end:
if (alp_tctx != NULL) if (alp_tctx != NULL)
AppLayerParserThreadCtxFree(alp_tctx); AppLayerParserThreadCtxFree(alp_tctx);
if (de_ctx != NULL)
SigGroupCleanup(de_ctx);
if (de_ctx != NULL)
SigCleanSignatures(de_ctx);
if (de_ctx != NULL) if (de_ctx != NULL)
DetectEngineCtxFree(de_ctx); DetectEngineCtxFree(de_ctx);
@ -2822,10 +2749,6 @@ static int DetectHttpServerBodyFileDataTest03(void)
end: end:
if (alp_tctx != NULL) if (alp_tctx != NULL)
AppLayerParserThreadCtxFree(alp_tctx); AppLayerParserThreadCtxFree(alp_tctx);
if (de_ctx != NULL)
SigGroupCleanup(de_ctx);
if (de_ctx != NULL)
SigCleanSignatures(de_ctx);
if (de_ctx != NULL) if (de_ctx != NULL)
DetectEngineCtxFree(de_ctx); DetectEngineCtxFree(de_ctx);
@ -2985,10 +2908,6 @@ static int DetectHttpServerBodyFileDataTest04(void)
end: end:
if (alp_tctx != NULL) if (alp_tctx != NULL)
AppLayerParserThreadCtxFree(alp_tctx); AppLayerParserThreadCtxFree(alp_tctx);
if (de_ctx != NULL)
SigGroupCleanup(de_ctx);
if (de_ctx != NULL)
SigCleanSignatures(de_ctx);
if (de_ctx != NULL) if (de_ctx != NULL)
DetectEngineCtxFree(de_ctx); DetectEngineCtxFree(de_ctx);
@ -3148,10 +3067,6 @@ static int DetectHttpServerBodyFileDataTest05(void)
end: end:
if (alp_tctx != NULL) if (alp_tctx != NULL)
AppLayerParserThreadCtxFree(alp_tctx); AppLayerParserThreadCtxFree(alp_tctx);
if (de_ctx != NULL)
SigGroupCleanup(de_ctx);
if (de_ctx != NULL)
SigCleanSignatures(de_ctx);
if (de_ctx != NULL) if (de_ctx != NULL)
DetectEngineCtxFree(de_ctx); DetectEngineCtxFree(de_ctx);
@ -3297,10 +3212,6 @@ static int DetectHttpServerBodyFileDataTest06(void)
end: end:
if (alp_tctx != NULL) if (alp_tctx != NULL)
AppLayerParserThreadCtxFree(alp_tctx); AppLayerParserThreadCtxFree(alp_tctx);
if (de_ctx != NULL)
SigGroupCleanup(de_ctx);
if (de_ctx != NULL)
SigCleanSignatures(de_ctx);
if (de_ctx != NULL) if (de_ctx != NULL)
DetectEngineCtxFree(de_ctx); DetectEngineCtxFree(de_ctx);
@ -3446,10 +3357,6 @@ static int DetectHttpServerBodyFileDataTest07(void)
end: end:
if (alp_tctx != NULL) if (alp_tctx != NULL)
AppLayerParserThreadCtxFree(alp_tctx); AppLayerParserThreadCtxFree(alp_tctx);
if (de_ctx != NULL)
SigGroupCleanup(de_ctx);
if (de_ctx != NULL)
SigCleanSignatures(de_ctx);
if (de_ctx != NULL) if (de_ctx != NULL)
DetectEngineCtxFree(de_ctx); DetectEngineCtxFree(de_ctx);
@ -3562,10 +3469,6 @@ static int DetectHttpServerBodyFileDataTest08(void)
end: end:
if (alp_tctx != NULL) if (alp_tctx != NULL)
AppLayerParserThreadCtxFree(alp_tctx); AppLayerParserThreadCtxFree(alp_tctx);
if (de_ctx != NULL)
SigGroupCleanup(de_ctx);
if (de_ctx != NULL)
SigCleanSignatures(de_ctx);
if (de_ctx != NULL) if (de_ctx != NULL)
DetectEngineCtxFree(de_ctx); DetectEngineCtxFree(de_ctx);
@ -3727,7 +3630,6 @@ end:
DetectEngineThreadCtxDeinit(&th_v, (void *)det_ctx); DetectEngineThreadCtxDeinit(&th_v, (void *)det_ctx);
} }
if (de_ctx != NULL) { if (de_ctx != NULL) {
SigGroupCleanup(de_ctx);
DetectEngineCtxFree(de_ctx); DetectEngineCtxFree(de_ctx);
} }
@ -3888,7 +3790,6 @@ end:
DetectEngineThreadCtxDeinit(&th_v, (void *)det_ctx); DetectEngineThreadCtxDeinit(&th_v, (void *)det_ctx);
} }
if (de_ctx != NULL) { if (de_ctx != NULL) {
SigGroupCleanup(de_ctx);
DetectEngineCtxFree(de_ctx); DetectEngineCtxFree(de_ctx);
} }

Loading…
Cancel
Save