Improve http-cookie keyword unittests error handling. Fix memory errors in the tests too.

remotes/origin/master-1.0.x
Victor Julien 15 years ago
parent d9d53fab5d
commit cd7e5cebec

@ -275,9 +275,9 @@ int DetectHttpCookieTest01(void)
if (de_ctx->sig_list == NULL)
result = 1;
end:
if (de_ctx != NULL) SigCleanSignatures(de_ctx);
if (de_ctx != NULL) DetectEngineCtxFree(de_ctx);
end:
if (de_ctx != NULL)
DetectEngineCtxFree(de_ctx);
return result;
}
@ -300,9 +300,9 @@ int DetectHttpCookieTest02(void)
if (de_ctx->sig_list == NULL)
result = 1;
end:
if (de_ctx != NULL) SigCleanSignatures(de_ctx);
if (de_ctx != NULL) DetectEngineCtxFree(de_ctx);
end:
if (de_ctx != NULL)
DetectEngineCtxFree(de_ctx);
return result;
}
@ -346,9 +346,9 @@ int DetectHttpCookieTest03(void)
sm = sm->next;
}
end:
if (de_ctx != NULL) SigCleanSignatures(de_ctx);
if (de_ctx != NULL) DetectEngineCtxFree(de_ctx);
end:
if (de_ctx != NULL)
DetectEngineCtxFree(de_ctx);
return result;
}
@ -371,9 +371,9 @@ int DetectHttpCookieTest04(void)
if (de_ctx->sig_list == NULL)
result = 1;
end:
if (de_ctx != NULL) SigCleanSignatures(de_ctx);
if (de_ctx != NULL) DetectEngineCtxFree(de_ctx);
end:
if (de_ctx != NULL)
DetectEngineCtxFree(de_ctx);
return result;
}
@ -438,9 +438,10 @@ int DetectHttpCookieTest06(void)
}
result = 1;
end:
if (de_ctx != NULL) SigCleanSignatures(de_ctx);
if (de_ctx != NULL) DetectEngineCtxFree(de_ctx);
end:
if (de_ctx != NULL) {
DetectEngineCtxFree(de_ctx);
}
return result;
}
@ -531,12 +532,17 @@ static int DetectHttpCookieSigTest01(void) {
}
result = 1;
if (de_ctx != NULL) DetectEngineCtxFree(de_ctx);
end:
if (http_state != NULL)
if (http_state != NULL) {
HTPStateFree(http_state);
if (de_ctx != NULL) SigGroupCleanup(de_ctx);
if (det_ctx != NULL) DetectEngineThreadCtxDeinit(&th_v, (void *)det_ctx);
}
if (det_ctx != NULL) {
DetectEngineThreadCtxDeinit(&th_v, (void *)det_ctx);
}
if (de_ctx != NULL) {
SigGroupCleanup(de_ctx);
DetectEngineCtxFree(de_ctx);
}
StreamL7DataPtrFree(&ssn);
StreamTcpFreeConfig(TRUE);
@ -619,10 +625,16 @@ static int DetectHttpCookieSigTest02(void) {
result = 1;
end:
if (http_state != NULL)
if (http_state != NULL) {
HTPStateFree(http_state);
if (de_ctx != NULL) SigGroupCleanup(de_ctx);
if (de_ctx != NULL) DetectEngineCtxFree(de_ctx);
}
if (det_ctx != NULL) {
DetectEngineThreadCtxDeinit(&th_v, (void *)det_ctx);
}
if (de_ctx != NULL) {
SigGroupCleanup(de_ctx);
DetectEngineCtxFree(de_ctx);
}
StreamL7DataPtrFree(&ssn);
StreamTcpFreeConfig(TRUE);
return result;
@ -704,11 +716,16 @@ static int DetectHttpCookieSigTest03(void) {
result = 1;
end:
if (http_state != NULL)
if (http_state != NULL) {
HTPStateFree(http_state);
if (de_ctx != NULL) SigGroupCleanup(de_ctx);
if (de_ctx != NULL) SigCleanSignatures(de_ctx);
if (de_ctx != NULL) DetectEngineCtxFree(de_ctx);
}
if (det_ctx != NULL) {
DetectEngineThreadCtxDeinit(&th_v, (void *)det_ctx);
}
if (de_ctx != NULL) {
SigGroupCleanup(de_ctx);
DetectEngineCtxFree(de_ctx);
}
StreamL7DataPtrFree(&ssn);
StreamTcpFreeConfig(TRUE);
@ -791,11 +808,16 @@ static int DetectHttpCookieSigTest04(void) {
result = 1;
end:
if (http_state != NULL)
if (http_state != NULL) {
HTPStateFree(http_state);
if (de_ctx != NULL) SigGroupCleanup(de_ctx);
if (de_ctx != NULL) SigCleanSignatures(de_ctx);
if (de_ctx != NULL) DetectEngineCtxFree(de_ctx);
}
if (det_ctx != NULL) {
DetectEngineThreadCtxDeinit(&th_v, (void *)det_ctx);
}
if (de_ctx != NULL) {
SigGroupCleanup(de_ctx);
DetectEngineCtxFree(de_ctx);
}
StreamL7DataPtrFree(&ssn);
StreamTcpFreeConfig(TRUE);
@ -878,11 +900,16 @@ static int DetectHttpCookieSigTest05(void) {
result = 1;
end:
if (http_state != NULL)
if (http_state != NULL) {
HTPStateFree(http_state);
if (de_ctx != NULL) SigGroupCleanup(de_ctx);
if (de_ctx != NULL) SigCleanSignatures(de_ctx);
if (de_ctx != NULL) DetectEngineCtxFree(de_ctx);
}
if (det_ctx != NULL) {
DetectEngineThreadCtxDeinit(&th_v, (void *)det_ctx);
}
if (de_ctx != NULL) {
SigGroupCleanup(de_ctx);
DetectEngineCtxFree(de_ctx);
}
StreamL7DataPtrFree(&ssn);
StreamTcpFreeConfig(TRUE);
@ -965,11 +992,16 @@ static int DetectHttpCookieSigTest06(void) {
result = 1;
end:
if (http_state != NULL)
if (http_state != NULL) {
HTPStateFree(http_state);
if (de_ctx != NULL) SigGroupCleanup(de_ctx);
if (de_ctx != NULL) SigCleanSignatures(de_ctx);
if (de_ctx != NULL) DetectEngineCtxFree(de_ctx);
}
if (det_ctx != NULL) {
DetectEngineThreadCtxDeinit(&th_v, (void *)det_ctx);
}
if (de_ctx != NULL) {
SigGroupCleanup(de_ctx);
DetectEngineCtxFree(de_ctx);
}
StreamL7DataPtrFree(&ssn);
StreamTcpFreeConfig(TRUE);
@ -1052,11 +1084,16 @@ static int DetectHttpCookieSigTest07(void) {
result = 1;
end:
if (http_state != NULL)
if (http_state != NULL) {
HTPStateFree(http_state);
if (de_ctx != NULL) SigGroupCleanup(de_ctx);
if (de_ctx != NULL) SigCleanSignatures(de_ctx);
if (de_ctx != NULL) DetectEngineCtxFree(de_ctx);
}
if (det_ctx != NULL) {
DetectEngineThreadCtxDeinit(&th_v, (void *)det_ctx);
}
if (de_ctx != NULL) {
SigGroupCleanup(de_ctx);
DetectEngineCtxFree(de_ctx);
}
StreamL7DataPtrFree(&ssn);
StreamTcpFreeConfig(TRUE);

Loading…
Cancel
Save