unittests: clean up memory for app-layer proto tests

pull/14025/head
Victor Julien 1 month ago committed by Victor Julien
parent b85cd8030f
commit bcd6481d80

@ -3227,20 +3227,17 @@ static int AppLayerProtoDetectTest16(void)
} }
result = 1; result = 1;
end: end:
if (alp_tctx != NULL) UTHFreePackets(&p, 1);
AppLayerParserThreadCtxFree(alp_tctx); UTHFreeFlow(f);
if (det_ctx != NULL) if (alp_tctx != NULL)
DetectEngineThreadCtxDeinit(&tv, det_ctx); AppLayerParserThreadCtxFree(alp_tctx);
if (de_ctx != NULL) if (det_ctx != NULL)
SigGroupCleanup(de_ctx); DetectEngineThreadCtxDeinit(&tv, det_ctx);
if (de_ctx != NULL) if (de_ctx != NULL)
DetectEngineCtxFree(de_ctx); DetectEngineCtxFree(de_ctx);
StreamTcpFreeConfig(true);
StreamTcpFreeConfig(true); StatsThreadCleanup(&tv);
return result;
UTHFreePackets(&p, 1);
UTHFreeFlow(f);
return result;
} }
/** \test test if the engine detect the proto on a non standar port /** \test test if the engine detect the proto on a non standar port
@ -3320,20 +3317,17 @@ static int AppLayerProtoDetectTest17(void)
result = 1; result = 1;
end: end:
if (alp_tctx != NULL) UTHFreePackets(&p, 1);
AppLayerParserThreadCtxFree(alp_tctx); UTHFreeFlow(f);
if (det_ctx != NULL) if (alp_tctx != NULL)
DetectEngineThreadCtxDeinit(&tv, det_ctx); AppLayerParserThreadCtxFree(alp_tctx);
if (de_ctx != NULL) if (det_ctx != NULL)
SigGroupCleanup(de_ctx); DetectEngineThreadCtxDeinit(&tv, det_ctx);
if (de_ctx != NULL) if (de_ctx != NULL)
DetectEngineCtxFree(de_ctx); DetectEngineCtxFree(de_ctx);
StreamTcpFreeConfig(true);
StreamTcpFreeConfig(true); StatsThreadCleanup(&tv);
return result;
UTHFreePackets(&p, 1);
UTHFreeFlow(f);
return result;
} }
/** \test test if the engine detect the proto and doesn't match /** \test test if the engine detect the proto and doesn't match
@ -3412,20 +3406,17 @@ static int AppLayerProtoDetectTest18(void)
result = 1; result = 1;
end: end:
if (alp_tctx != NULL) UTHFreePackets(&p, 1);
AppLayerParserThreadCtxFree(alp_tctx); UTHFreeFlow(f);
if (det_ctx != NULL) if (alp_tctx != NULL)
DetectEngineThreadCtxDeinit(&tv, det_ctx); AppLayerParserThreadCtxFree(alp_tctx);
if (de_ctx != NULL) if (det_ctx != NULL)
SigGroupCleanup(de_ctx); DetectEngineThreadCtxDeinit(&tv, det_ctx);
if (de_ctx != NULL) if (de_ctx != NULL)
DetectEngineCtxFree(de_ctx); DetectEngineCtxFree(de_ctx);
StreamTcpFreeConfig(true);
StreamTcpFreeConfig(true); StatsThreadCleanup(&tv);
return result;
UTHFreePackets(&p, 1);
UTHFreeFlow(f);
return result;
} }
/** \test test if the engine detect the proto and doesn't match /** \test test if the engine detect the proto and doesn't match
@ -3496,19 +3487,17 @@ static int AppLayerProtoDetectTest19(void)
result = 1; result = 1;
end: end:
if (alp_tctx != NULL) UTHFreePackets(&p, 1);
AppLayerParserThreadCtxFree(alp_tctx); UTHFreeFlow(f);
if (det_ctx != NULL) if (alp_tctx != NULL)
DetectEngineThreadCtxDeinit(&tv, det_ctx); AppLayerParserThreadCtxFree(alp_tctx);
if (de_ctx != NULL) if (det_ctx != NULL)
SigGroupCleanup(de_ctx); DetectEngineThreadCtxDeinit(&tv, det_ctx);
if (de_ctx != NULL) if (de_ctx != NULL)
DetectEngineCtxFree(de_ctx); DetectEngineCtxFree(de_ctx);
StreamTcpFreeConfig(true);
StreamTcpFreeConfig(true); StatsThreadCleanup(&tv);
UTHFreePackets(&p, 1); return result;
UTHFreeFlow(f);
return result;
} }
void AppLayerProtoDetectUnittestsRegister(void) void AppLayerProtoDetectUnittestsRegister(void)

Loading…
Cancel
Save