Minor unittest fixes to make Coverity happy.

remotes/origin/master
Victor Julien 14 years ago
parent 5c397e3a53
commit 40fcae3aa0

@ -637,8 +637,10 @@ static int DecodeIPV6FragTest01 (void) {
if (p1 == NULL)
return 0;
Packet *p2 = SCMalloc(SIZE_OF_PACKET);
if (p2 == NULL)
if (p2 == NULL) {
SCFree(p1);
return 0;
}
ThreadVars tv;
DecodeThreadVars dtv;
int result = 0;

@ -874,6 +874,9 @@ int DetectBytejumpTestParse08(void) {
*/
int DetectBytejumpTestParse09(void) {
Signature *s = SigAlloc();
if (s == NULL)
return 0;
int result = 1;
s->alproto = ALPROTO_DCERPC;

@ -1029,6 +1029,9 @@ int DetectBytetestTestParse18(void) {
*/
int DetectBytetestTestParse19(void) {
Signature *s = SigAlloc();
if (s == NULL)
return 0;
int result = 1;
s->alproto = ALPROTO_DCERPC;

@ -1041,6 +1041,9 @@ int DetectContentParseTest18(void)
SigFree(s);
s = SigAlloc();
if (s == NULL)
return 0;
result &= (DetectContentSetup(de_ctx, s, "\"one\"") == 0);
result &= (s->sm_lists[DETECT_SM_LIST_DMATCH] == NULL && s->sm_lists[DETECT_SM_LIST_PMATCH] != NULL);

@ -402,6 +402,9 @@ static int DetectDceIfaceTestParse01(void)
SCEnter();
Signature *s = SigAlloc();
if (s == NULL)
return 0;
int result = 0;
DetectDceIfaceData *did = NULL;
uint8_t test_uuid[] = {0x12, 0x34, 0x56, 0x78, 0x12, 0x34, 0x12, 0x34, 0x12, 0x34,
@ -442,6 +445,9 @@ static int DetectDceIfaceTestParse02(void)
SCEnter();
Signature *s = SigAlloc();
if (s == NULL)
return 0;
int result = 0;
DetectDceIfaceData *did = NULL;
uint8_t test_uuid[] = {0x12, 0x34, 0x56, 0x78, 0x12, 0x34, 0x12, 0x34, 0x12, 0x34,
@ -482,6 +488,9 @@ static int DetectDceIfaceTestParse03(void)
SCEnter();
Signature *s = SigAlloc();
if (s == NULL)
return 0;
int result = 0;
DetectDceIfaceData *did = NULL;
uint8_t test_uuid[] = {0x12, 0x34, 0x56, 0x78, 0x12, 0x34, 0x12, 0x34, 0x12, 0x34,
@ -518,6 +527,9 @@ static int DetectDceIfaceTestParse04(void)
SCEnter();
Signature *s = SigAlloc();
if (s == NULL)
return 0;
int result = 0;
DetectDceIfaceData *did = NULL;
uint8_t test_uuid[] = {0x12, 0x34, 0x56, 0x78, 0x12, 0x34, 0x12, 0x34, 0x12, 0x34,
@ -598,6 +610,9 @@ static int DetectDceIfaceTestParse06(void)
SCEnter();
Signature *s = SigAlloc();
if (s == NULL)
return 0;
int result = 0;
DetectDceIfaceData *did = NULL;
uint8_t test_uuid[] = {0x12, 0x34, 0x56, 0x78, 0x12, 0x34, 0x12, 0x34, 0x12, 0x34,
@ -638,6 +653,9 @@ static int DetectDceIfaceTestParse07(void)
SCEnter();
Signature *s = SigAlloc();
if (s == NULL)
return 0;
int result = 0;
DetectDceIfaceData *did = NULL;
uint8_t test_uuid[] = {0x12, 0x34, 0x56, 0x78, 0x12, 0x34, 0x12, 0x34, 0x12, 0x34,
@ -676,6 +694,9 @@ static int DetectDceIfaceTestParse07(void)
static int DetectDceIfaceTestParse08(void)
{
Signature *s = SigAlloc();
if (s == NULL)
return 0;
int result = 0;
DetectDceIfaceData *did = NULL;
uint8_t test_uuid[] = {0x12, 0x34, 0x56, 0x78, 0x12, 0x34, 0x12, 0x34, 0x12, 0x34,
@ -716,6 +737,9 @@ static int DetectDceIfaceTestParse09(void)
SCEnter();
Signature *s = SigAlloc();
if (s == NULL)
return 0;
int result = 0;
DetectDceIfaceData *did = NULL;
uint8_t test_uuid[] = {0x12, 0x34, 0x56, 0x78, 0x12, 0x34, 0x12, 0x34, 0x12, 0x34,
@ -752,6 +776,9 @@ static int DetectDceIfaceTestParse10(void)
SCEnter();
Signature *s = SigAlloc();
if (s == NULL)
return 0;
int result = 0;
DetectDceIfaceData *did = NULL;
uint8_t test_uuid[] = {0x12, 0x34, 0x56, 0x78, 0x12, 0x34, 0x12, 0x34, 0x12, 0x34,
@ -792,6 +819,9 @@ static int DetectDceIfaceTestParse11(void)
SCEnter();
Signature *s = SigAlloc();
if (s == NULL)
return 0;
int result = 1;
result &= (DetectDceIfaceSetup(NULL, s, "12345678-1234-1234-1234-123456789ABC,>1,ay_frag") == -1);

@ -11207,19 +11207,19 @@ int DetectFastPatternTest387(void)
if (de_ctx->sig_list == NULL)
goto end;
result = 0;
sm = de_ctx->sig_list->sm_lists[DETECT_SM_LIST_HSMDMATCH];
if (sm != NULL) {
DetectContentData *ud = sm->ctx;
if (ud->flags & DETECT_CONTENT_FAST_PATTERN &&
if (sm == NULL) {
goto end;
}
DetectContentData *ud = sm->ctx;
if (ud->flags & DETECT_CONTENT_FAST_PATTERN &&
ud->flags & DETECT_CONTENT_FAST_PATTERN_ONLY &&
!(ud->flags & DETECT_CONTENT_FAST_PATTERN_CHOP) &&
ud->fp_chop_offset == 0 &&
ud->fp_chop_len == 0) {
result = 1;
} else {
result = 0;
}
result = 1;
} else {
result = 0;
}
end:
@ -11243,19 +11243,20 @@ int DetectFastPatternTest388(void)
if (de_ctx->sig_list == NULL)
goto end;
result = 0;
sm = de_ctx->sig_list->sm_lists[DETECT_SM_LIST_HSMDMATCH];
if (sm != NULL) {
DetectContentData *ud = sm->ctx;
if (ud->flags & DETECT_CONTENT_FAST_PATTERN &&
if (sm == NULL) {
goto end;
}
DetectContentData *ud = sm->ctx;
if (ud->flags & DETECT_CONTENT_FAST_PATTERN &&
!(ud->flags & DETECT_CONTENT_FAST_PATTERN_ONLY) &&
ud->flags & DETECT_CONTENT_FAST_PATTERN_CHOP &&
ud->fp_chop_offset == 3 &&
ud->fp_chop_len == 4) {
result = 1;
} else {
result = 0;
}
result = 1;
} else {
result = 0;
}
end:
@ -12248,26 +12249,6 @@ int DetectFastPatternTest424(void)
DetectEngineCtxFree(de_ctx);
return result;
}
int DetectFastPatternTest425(void)
{
@ -12390,19 +12371,20 @@ int DetectFastPatternTest428(void)
if (de_ctx->sig_list == NULL)
goto end;
result = 0;
sm = de_ctx->sig_list->sm_lists[DETECT_SM_LIST_HSCDMATCH];
if (sm != NULL) {
DetectContentData *ud = sm->ctx;
if (ud->flags & DETECT_CONTENT_FAST_PATTERN &&
if (sm == NULL) {
goto end;
}
DetectContentData *ud = sm->ctx;
if (ud->flags & DETECT_CONTENT_FAST_PATTERN &&
ud->flags & DETECT_CONTENT_FAST_PATTERN_ONLY &&
!(ud->flags & DETECT_CONTENT_FAST_PATTERN_CHOP) &&
ud->fp_chop_offset == 0 &&
ud->fp_chop_len == 0) {
result = 1;
} else {
result = 0;
}
result = 1;
} else {
result = 0;
}
end:
@ -12426,19 +12408,20 @@ int DetectFastPatternTest429(void)
if (de_ctx->sig_list == NULL)
goto end;
result = 0;
sm = de_ctx->sig_list->sm_lists[DETECT_SM_LIST_HSCDMATCH];
if (sm != NULL) {
DetectContentData *ud = sm->ctx;
if (ud->flags & DETECT_CONTENT_FAST_PATTERN &&
if (sm == NULL) {
goto end;
}
DetectContentData *ud = sm->ctx;
if (ud->flags & DETECT_CONTENT_FAST_PATTERN &&
!(ud->flags & DETECT_CONTENT_FAST_PATTERN_ONLY) &&
ud->flags & DETECT_CONTENT_FAST_PATTERN_CHOP &&
ud->fp_chop_offset == 3 &&
ud->fp_chop_len == 4) {
result = 1;
} else {
result = 0;
}
result = 1;
} else {
result = 0;
}
end:
@ -13432,27 +13415,6 @@ int DetectFastPatternTest465(void)
return result;
}
int DetectFastPatternTest466(void)
{
DetectEngineCtx *de_ctx = NULL;
@ -13574,19 +13536,19 @@ int DetectFastPatternTest469(void)
if (de_ctx->sig_list == NULL)
goto end;
result = 0;
sm = de_ctx->sig_list->sm_lists[DETECT_SM_LIST_HSCDMATCH];
if (sm != NULL) {
DetectContentData *ud = sm->ctx;
if (ud->flags & DETECT_CONTENT_FAST_PATTERN &&
if (sm == NULL) {
goto end;
}
DetectContentData *ud = sm->ctx;
if (ud->flags & DETECT_CONTENT_FAST_PATTERN &&
ud->flags & DETECT_CONTENT_FAST_PATTERN_ONLY &&
!(ud->flags & DETECT_CONTENT_FAST_PATTERN_CHOP) &&
ud->fp_chop_offset == 0 &&
ud->fp_chop_len == 0) {
result = 1;
} else {
result = 0;
}
result = 1;
} else {
result = 0;
}
end:
@ -13610,19 +13572,20 @@ int DetectFastPatternTest470(void)
if (de_ctx->sig_list == NULL)
goto end;
result = 0;
sm = de_ctx->sig_list->sm_lists[DETECT_SM_LIST_HSCDMATCH];
if (sm != NULL) {
DetectContentData *ud = sm->ctx;
if (ud->flags & DETECT_CONTENT_FAST_PATTERN &&
if (sm == NULL) {
goto end;
}
DetectContentData *ud = sm->ctx;
if (ud->flags & DETECT_CONTENT_FAST_PATTERN &&
!(ud->flags & DETECT_CONTENT_FAST_PATTERN_ONLY) &&
ud->flags & DETECT_CONTENT_FAST_PATTERN_CHOP &&
ud->fp_chop_offset == 3 &&
ud->fp_chop_len == 4) {
result = 1;
} else {
result = 0;
}
result = 1;
} else {
result = 0;
}
end:

@ -455,7 +455,7 @@ int DetectFlowintTestParseVal01(void)
DetectEngineCtx *de_ctx;
de_ctx = DetectEngineCtxInit();
if (de_ctx == NULL)
goto error;
return 0;
de_ctx->flags |= DE_QUIET;
sfd = DetectFlowintParse(de_ctx, "myvar,=,35");
@ -469,10 +469,6 @@ int DetectFlowintTestParseVal01(void)
DetectEngineCtxFree(de_ctx);
return result;
error:
if (de_ctx)
DetectEngineCtxFree(de_ctx);
return result;
}
/**
@ -486,7 +482,7 @@ int DetectFlowintTestParseVar01(void)
DetectEngineCtx *de_ctx;
de_ctx = DetectEngineCtxInit();
if (de_ctx == NULL)
goto error;
return 0;
de_ctx->flags |= DE_QUIET;
sfd = DetectFlowintParse(de_ctx, "myvar,=,targetvar");
@ -503,10 +499,6 @@ int DetectFlowintTestParseVar01(void)
DetectEngineCtxFree(de_ctx);
return result;
error:
if (de_ctx)
DetectEngineCtxFree(de_ctx);
return result;
}
/**
@ -520,7 +512,7 @@ int DetectFlowintTestParseVal02(void)
DetectEngineCtx *de_ctx;
de_ctx = DetectEngineCtxInit();
if (de_ctx == NULL)
goto error;
return 0;
de_ctx->flags |= DE_QUIET;
sfd = DetectFlowintParse(de_ctx, "myvar,+,35");
@ -534,10 +526,6 @@ int DetectFlowintTestParseVal02(void)
DetectEngineCtxFree(de_ctx);
return result;
error:
if (de_ctx)
DetectEngineCtxFree(de_ctx);
return result;
}
/**
@ -551,7 +539,7 @@ int DetectFlowintTestParseVar02(void)
DetectEngineCtx *de_ctx;
de_ctx = DetectEngineCtxInit();
if (de_ctx == NULL)
goto error;
return 0;
de_ctx->flags |= DE_QUIET;
sfd = DetectFlowintParse(de_ctx, "myvar,+,targetvar");
@ -568,10 +556,6 @@ int DetectFlowintTestParseVar02(void)
DetectEngineCtxFree(de_ctx);
return result;
error:
if (de_ctx)
DetectEngineCtxFree(de_ctx);
return result;
}
/**
@ -585,7 +569,7 @@ int DetectFlowintTestParseVal03(void)
DetectEngineCtx *de_ctx;
de_ctx = DetectEngineCtxInit();
if (de_ctx == NULL)
goto error;
return 0;
de_ctx->flags |= DE_QUIET;
sfd = DetectFlowintParse(de_ctx, "myvar,-,35");
@ -599,10 +583,6 @@ int DetectFlowintTestParseVal03(void)
DetectEngineCtxFree(de_ctx);
return result;
error:
if (de_ctx)
DetectEngineCtxFree(de_ctx);
return result;
}
/**
@ -616,7 +596,7 @@ int DetectFlowintTestParseVar03(void)
DetectEngineCtx *de_ctx;
de_ctx = DetectEngineCtxInit();
if (de_ctx == NULL)
goto error;
return 0;
de_ctx->flags |= DE_QUIET;
sfd = DetectFlowintParse(de_ctx, "myvar,-,targetvar");
@ -633,10 +613,6 @@ int DetectFlowintTestParseVar03(void)
DetectEngineCtxFree(de_ctx);
return result;
error:
if (de_ctx)
DetectEngineCtxFree(de_ctx);
return result;
}
@ -651,7 +627,7 @@ int DetectFlowintTestParseVal04(void)
DetectEngineCtx *de_ctx;
de_ctx = DetectEngineCtxInit();
if (de_ctx == NULL)
goto error;
return 0;
de_ctx->flags |= DE_QUIET;
sfd = DetectFlowintParse(de_ctx, "myvar,==,35");
@ -665,10 +641,6 @@ int DetectFlowintTestParseVal04(void)
DetectEngineCtxFree(de_ctx);
return result;
error:
if (de_ctx)
DetectEngineCtxFree(de_ctx);
return result;
}
/**
@ -682,7 +654,7 @@ int DetectFlowintTestParseVar04(void)
DetectEngineCtx *de_ctx;
de_ctx = DetectEngineCtxInit();
if (de_ctx == NULL)
goto error;
return 0;
de_ctx->flags |= DE_QUIET;
sfd = DetectFlowintParse(de_ctx, "myvar,==,targetvar");
@ -699,10 +671,6 @@ int DetectFlowintTestParseVar04(void)
DetectEngineCtxFree(de_ctx);
return result;
error:
if (de_ctx)
DetectEngineCtxFree(de_ctx);
return result;
}
/**
@ -716,7 +684,7 @@ int DetectFlowintTestParseVal05(void)
DetectEngineCtx *de_ctx;
de_ctx = DetectEngineCtxInit();
if (de_ctx == NULL)
goto error;
return 0;
de_ctx->flags |= DE_QUIET;
sfd = DetectFlowintParse(de_ctx, "myvar,!=,35");
@ -730,10 +698,6 @@ int DetectFlowintTestParseVal05(void)
DetectEngineCtxFree(de_ctx);
return result;
error:
if (de_ctx)
DetectEngineCtxFree(de_ctx);
return result;
}
/**
@ -747,7 +711,7 @@ int DetectFlowintTestParseVar05(void)
DetectEngineCtx *de_ctx;
de_ctx = DetectEngineCtxInit();
if (de_ctx == NULL)
goto error;
return 0;
de_ctx->flags |= DE_QUIET;
sfd = DetectFlowintParse(de_ctx, "myvar,!=,targetvar");
@ -764,10 +728,6 @@ int DetectFlowintTestParseVar05(void)
DetectEngineCtxFree(de_ctx);
return result;
error:
if (de_ctx)
DetectEngineCtxFree(de_ctx);
return result;
}
/**
@ -781,7 +741,7 @@ int DetectFlowintTestParseVal06(void)
DetectEngineCtx *de_ctx;
de_ctx = DetectEngineCtxInit();
if (de_ctx == NULL)
goto error;
return 0;
de_ctx->flags |= DE_QUIET;
sfd = DetectFlowintParse(de_ctx, "myvar, >,35");
@ -795,10 +755,6 @@ int DetectFlowintTestParseVal06(void)
DetectEngineCtxFree(de_ctx);
return result;
error:
if (de_ctx)
DetectEngineCtxFree(de_ctx);
return result;
}
/**
@ -812,7 +768,7 @@ int DetectFlowintTestParseVar06(void)
DetectEngineCtx *de_ctx;
de_ctx = DetectEngineCtxInit();
if (de_ctx == NULL)
goto error;
return 0;
de_ctx->flags |= DE_QUIET;
sfd = DetectFlowintParse(de_ctx, "myvar, >,targetvar");
@ -829,10 +785,6 @@ int DetectFlowintTestParseVar06(void)
DetectEngineCtxFree(de_ctx);
return result;
error:
if (de_ctx)
DetectEngineCtxFree(de_ctx);
return result;
}
/**
@ -846,7 +798,7 @@ int DetectFlowintTestParseVal07(void)
DetectEngineCtx *de_ctx;
de_ctx = DetectEngineCtxInit();
if (de_ctx == NULL)
goto error;
return 0;
de_ctx->flags |= DE_QUIET;
sfd = DetectFlowintParse(de_ctx, "myvar, >= ,35");
@ -860,10 +812,6 @@ int DetectFlowintTestParseVal07(void)
DetectEngineCtxFree(de_ctx);
return result;
error:
if (de_ctx)
DetectEngineCtxFree(de_ctx);
return result;
}
/**
@ -877,7 +825,7 @@ int DetectFlowintTestParseVar07(void)
DetectEngineCtx *de_ctx;
de_ctx = DetectEngineCtxInit();
if (de_ctx == NULL)
goto error;
return 0;
de_ctx->flags |= DE_QUIET;
sfd = DetectFlowintParse(de_ctx, "myvar, >= ,targetvar");
@ -894,10 +842,6 @@ int DetectFlowintTestParseVar07(void)
DetectEngineCtxFree(de_ctx);
return result;
error:
if (de_ctx)
DetectEngineCtxFree(de_ctx);
return result;
}
/**
@ -911,7 +855,7 @@ int DetectFlowintTestParseVal08(void)
DetectEngineCtx *de_ctx;
de_ctx = DetectEngineCtxInit();
if (de_ctx == NULL)
goto error;
return 0;
de_ctx->flags |= DE_QUIET;
sfd = DetectFlowintParse(de_ctx, "myvar, <= ,35");
@ -925,10 +869,6 @@ int DetectFlowintTestParseVal08(void)
DetectEngineCtxFree(de_ctx);
return result;
error:
if (de_ctx)
DetectEngineCtxFree(de_ctx);
return result;
}
/**
@ -942,7 +882,7 @@ int DetectFlowintTestParseVar08(void)
DetectEngineCtx *de_ctx;
de_ctx = DetectEngineCtxInit();
if (de_ctx == NULL)
goto error;
return 0;
de_ctx->flags |= DE_QUIET;
sfd = DetectFlowintParse(de_ctx, "myvar, <= ,targetvar");
@ -959,10 +899,6 @@ int DetectFlowintTestParseVar08(void)
DetectEngineCtxFree(de_ctx);
return result;
error:
if (de_ctx)
DetectEngineCtxFree(de_ctx);
return result;
}
/**
@ -976,7 +912,7 @@ int DetectFlowintTestParseVal09(void)
DetectEngineCtx *de_ctx;
de_ctx = DetectEngineCtxInit();
if (de_ctx == NULL)
goto error;
return 0;
de_ctx->flags |= DE_QUIET;
sfd = DetectFlowintParse(de_ctx, "myvar, < ,35");
@ -990,10 +926,6 @@ int DetectFlowintTestParseVal09(void)
DetectEngineCtxFree(de_ctx);
return result;
error:
if (de_ctx)
DetectEngineCtxFree(de_ctx);
return result;
}
/**
@ -1007,7 +939,7 @@ int DetectFlowintTestParseVar09(void)
DetectEngineCtx *de_ctx;
de_ctx = DetectEngineCtxInit();
if (de_ctx == NULL)
goto error;
return 0;
de_ctx->flags |= DE_QUIET;
sfd = DetectFlowintParse(de_ctx, "myvar, < ,targetvar");
@ -1024,10 +956,6 @@ int DetectFlowintTestParseVar09(void)
DetectEngineCtxFree(de_ctx);
return result;
error:
if (de_ctx)
DetectEngineCtxFree(de_ctx);
return result;
}
/**
@ -1041,7 +969,7 @@ int DetectFlowintTestParseIsset10(void)
DetectEngineCtx *de_ctx;
de_ctx = DetectEngineCtxInit();
if (de_ctx == NULL)
goto error;
return 0;
de_ctx->flags |= DE_QUIET;
sfd = DetectFlowintParse(de_ctx, "myvar, isset");
@ -1071,10 +999,6 @@ int DetectFlowintTestParseIsset10(void)
DetectEngineCtxFree(de_ctx);
return result;
error:
if (de_ctx)
DetectEngineCtxFree(de_ctx);
return result;
}
/**

@ -389,25 +389,18 @@ static int HTTPUriTest01(void) {
if (tx->request_method_number != M_GET ||
tx->request_protocol_number != HTTP_1_1)
{
printf("expected method GET and got %s: , expected protocol "
"HTTP/1.1 and got %s \n", bstr_tocstr(tx->request_method),
bstr_tocstr(tx->request_protocol));
goto end;
}
if ((tx->parsed_uri->hostname == NULL) ||
(bstr_cmpc(tx->parsed_uri->hostname, "www.example.com") != 0))
{
printf("expected www.example.com as hostname, but got: %s \n",
bstr_tocstr(tx->parsed_uri->hostname));
goto end;
}
if ((tx->parsed_uri->path == NULL) ||
(bstr_cmpc(tx->parsed_uri->path, "/images.gif") != 0))
{
printf("expected /images.gif as path, but got: %s \n",
bstr_tocstr(tx->parsed_uri->path));
goto end;
}
@ -456,25 +449,18 @@ static int HTTPUriTest02(void) {
if (tx->request_method_number != M_GET ||
tx->request_protocol_number != HTTP_1_1)
{
printf("expected method GET and got %s: , expected protocol "
"HTTP/1.1 and got %s \n", bstr_tocstr(tx->request_method),
bstr_tocstr(tx->request_protocol));
goto end;
}
if ((tx->parsed_uri->hostname == NULL) ||
(bstr_cmpc(tx->parsed_uri->hostname, "www.example.com") != 0))
{
printf("expected www.example.com as hostname, but got: %s \n",
bstr_tocstr(tx->parsed_uri->hostname));
goto end;
}
if ((tx->parsed_uri->path == NULL) ||
(bstr_cmpc(tx->parsed_uri->path, "/images.gif") != 0))
{
printf("expected /images.gif as path, but got: %s \n",
bstr_tocstr(tx->parsed_uri->path));
goto end;
}
@ -525,25 +511,18 @@ static int HTTPUriTest03(void) {
if (tx->request_method_number != M_UNKNOWN ||
tx->request_protocol_number != HTTP_1_1)
{
printf("expected method GET and got %s: , expected protocol "
"HTTP/1.1 and got %s \n", bstr_tocstr(tx->request_method),
bstr_tocstr(tx->request_protocol));
goto end;
}
if ((tx->parsed_uri->hostname == NULL) ||
(bstr_cmpc(tx->parsed_uri->hostname, "www.example.com") != 0))
{
printf("expected www.example.com as hostname, but got: %s \n",
bstr_tocstr(tx->parsed_uri->hostname));
goto end;
}
if ((tx->parsed_uri->path == NULL) ||
(bstr_cmpc(tx->parsed_uri->path, "/images.gif") != 0))
{
printf("expected /images.gif as path, but got: %s \n",
bstr_tocstr(tx->parsed_uri->path));
goto end;
}
@ -587,7 +566,6 @@ static int HTTPUriTest04(void) {
htp_state = f.alstate;
if (htp_state == NULL) {
printf("no http state: ");
result = 0;
goto end;
}
@ -596,28 +574,18 @@ static int HTTPUriTest04(void) {
if (tx->request_method_number != M_GET ||
tx->request_protocol_number != HTTP_1_1)
{
printf("expected method GET and got %s: , expected protocol "
"HTTP/1.1 and got %s \n", bstr_tocstr(tx->request_method),
bstr_tocstr(tx->request_protocol));
result = 0;
goto end;
}
if ((tx->parsed_uri->hostname == NULL) ||
(bstr_cmpc(tx->parsed_uri->hostname, "www.example.com") != 0))
{
printf("expected www.example.com as hostname, but got: %s \n",
bstr_tocstr(tx->parsed_uri->hostname));
result = 0;
goto end;
}
if ((tx->parsed_uri->path == NULL) ||
(bstr_cmpc(tx->parsed_uri->path, "/images.gif") != 0))
{
printf("expected /images.gif as path, but got: %s \n",
bstr_tocstr(tx->parsed_uri->path));
result = 0;
goto end;
}

@ -289,10 +289,8 @@ DetectUrilenData *DetectUrilenParse (char *urilenstr)
}
}
if (arg1 != NULL)
pcre_free_substring(arg1);
if (arg2 != NULL)
pcre_free_substring(arg2);
pcre_free_substring(arg1);
pcre_free_substring(arg2);
if (arg3 != NULL)
pcre_free_substring(arg3);
if (arg4 != NULL)

@ -6293,8 +6293,10 @@ int SigTest24IPV4Keyword(void)
if (p1 == NULL)
return 0;
Packet *p2 = SCMalloc(SIZE_OF_PACKET);
if (p2 == NULL)
if (p2 == NULL) {
SCFree(p1);
return 0;
}
ThreadVars th_v;
DetectEngineThreadCtx *det_ctx = NULL;
int result = 0;
@ -6397,8 +6399,10 @@ int SigTest25NegativeIPV4Keyword(void)
if (p1 == NULL)
return 0;
Packet *p2 = SCMalloc(SIZE_OF_PACKET);
if (p2 == NULL)
if (p2 == NULL) {
SCFree(p1);
return 0;
}
ThreadVars th_v;
DetectEngineThreadCtx *det_ctx;
int result = 1;
@ -6508,8 +6512,10 @@ int SigTest26TCPV4Keyword(void)
return 0;
Packet *p2 = SCMalloc(SIZE_OF_PACKET);
if (p2 == NULL)
if (p2 == NULL) {
SCFree(p1);
return 0;
}
ThreadVars th_v;
DetectEngineThreadCtx *det_ctx;
@ -6621,8 +6627,10 @@ int SigTest27NegativeTCPV4Keyword(void)
if (p1 == NULL)
return 0;
Packet *p2 = SCMalloc(SIZE_OF_PACKET);
if (p2 == NULL)
if (p2 == NULL) {
SCFree(p1);
return 0;
}
ThreadVars th_v;
DetectEngineThreadCtx *det_ctx;
int result = 0;
@ -6745,8 +6753,10 @@ int SigTest28TCPV6Keyword(void)
if (p1 == NULL)
return 0;
Packet *p2 = SCMalloc(SIZE_OF_PACKET);
if (p2 == NULL)
if (p2 == NULL) {
SCFree(p1);
return 0;
}
ThreadVars th_v;
DetectEngineThreadCtx *det_ctx;
int result = 0;
@ -6869,8 +6879,10 @@ int SigTest29NegativeTCPV6Keyword(void)
if (p1 == NULL)
return 0;
Packet *p2 = SCMalloc(SIZE_OF_PACKET);
if (p2 == NULL)
if (p2 == NULL) {
SCFree(p1);
return 0;
}
ThreadVars th_v;
DetectEngineThreadCtx *det_ctx = NULL;
int result = 0;
@ -6992,8 +7004,10 @@ int SigTest30UDPV4Keyword(void)
if (p1 == NULL)
return 0;
Packet *p2 = SCMalloc(SIZE_OF_PACKET);
if (p2 == NULL)
if (p2 == NULL) {
SCFree(p1);
return 0;
}
ThreadVars th_v;
DetectEngineThreadCtx *det_ctx = NULL;
int result = 1;
@ -7115,8 +7129,10 @@ int SigTest31NegativeUDPV4Keyword(void)
if (p1 == NULL)
return 0;
Packet *p2 = SCMalloc(SIZE_OF_PACKET);
if (p2 == NULL)
if (p2 == NULL) {
SCFree(p1);
return 0;
}
ThreadVars th_v;
DetectEngineThreadCtx *det_ctx = NULL;
int result = 1;
@ -7232,8 +7248,10 @@ int SigTest32UDPV6Keyword(void)
if (p1 == NULL)
return 0;
Packet *p2 = SCMalloc(SIZE_OF_PACKET);
if (p2 == NULL)
if (p2 == NULL) {
SCFree(p1);
return 0;
}
ThreadVars th_v;
DetectEngineThreadCtx *det_ctx = NULL;
int result = 1;
@ -7347,8 +7365,10 @@ int SigTest33NegativeUDPV6Keyword(void)
if (p1 == NULL)
return 0;
Packet *p2 = SCMalloc(SIZE_OF_PACKET);
if (p2 == NULL)
if (p2 == NULL) {
SCFree(p1);
return 0;
}
ThreadVars th_v;
DetectEngineThreadCtx *det_ctx = NULL;
int result = 1;
@ -7464,8 +7484,10 @@ int SigTest34ICMPV4Keyword(void)
if (p1 == NULL)
return 0;
Packet *p2 = SCMalloc(SIZE_OF_PACKET);
if (p2 == NULL)
if (p2 == NULL) {
SCFree(p1);
return 0;
}
ThreadVars th_v;
DetectEngineThreadCtx *det_ctx = NULL;
int result = 1;
@ -7584,8 +7606,10 @@ int SigTest35NegativeICMPV4Keyword(void)
if (p1 == NULL)
return 0;
Packet *p2 = SCMalloc(SIZE_OF_PACKET);
if (p2 == NULL)
if (p2 == NULL) {
SCFree(p1);
return 0;
}
ThreadVars th_v;
DetectEngineThreadCtx *det_ctx;
int result = 1;
@ -7715,8 +7739,10 @@ int SigTest36ICMPV6Keyword(void)
if (p1 == NULL)
return 0;
Packet *p2 = SCMalloc(SIZE_OF_PACKET);
if (p2 == NULL)
if (p2 == NULL) {
SCFree(p1);
return 0;
}
ThreadVars th_v;
DetectEngineThreadCtx *det_ctx = NULL;
int result = 1;
@ -7843,8 +7869,10 @@ int SigTest37NegativeICMPV6Keyword(void)
if (p1 == NULL)
return 0;
Packet *p2 = SCMalloc(SIZE_OF_PACKET);
if (p2 == NULL)
if (p2 == NULL) {
SCFree(p1);
return 0;
}
ThreadVars th_v;
DetectEngineThreadCtx *det_ctx = NULL;
int result = 1;

@ -4176,8 +4176,10 @@ int SCRadixTestIPV4NetblockInsertion26(void)
str = SCStrdup("Hello1");
bzero(&servaddr, sizeof(servaddr));
if (inet_pton(AF_INET, "0.0.0.0", &servaddr.sin_addr) <= 0)
if (inet_pton(AF_INET, "0.0.0.0", &servaddr.sin_addr) <= 0) {
SCFree(str);
return 0;
}
tmp = SCRadixAddKeyIPV4Netblock((uint8_t *)&servaddr.sin_addr, tree, str, 7);
if (!tmp) {
printf("Not inserted correctly 3 :");

Loading…
Cancel
Save