Fix compiler warnings in two unittests.

remotes/origin/master-1.1.x
Victor Julien 15 years ago
parent a3be22cd5a
commit b9fd978253

@ -2642,6 +2642,7 @@ end:
int SigTestBidirec04 (void) { int SigTestBidirec04 (void) {
int result = 0; int result = 0;
Signature *sig = NULL; Signature *sig = NULL;
Packet *p = NULL;
DetectEngineCtx *de_ctx = DetectEngineCtxInit(); DetectEngineCtx *de_ctx = DetectEngineCtxInit();
if (de_ctx == NULL) if (de_ctx == NULL)
@ -2737,7 +2738,7 @@ int SigTestBidirec04 (void) {
0x6b,0x65,0x65,0x70,0x2d,0x61,0x6c,0x69, 0x6b,0x65,0x65,0x70,0x2d,0x61,0x6c,0x69,
0x76,0x65,0x0d,0x0a,0x0d,0x0a }; /* end rawpkt1_ether */ 0x76,0x65,0x0d,0x0a,0x0d,0x0a }; /* end rawpkt1_ether */
Packet *p = SCMalloc(SIZE_OF_PACKET); p = SCMalloc(SIZE_OF_PACKET);
if (p == NULL) if (p == NULL)
return 0; return 0;
DecodeThreadVars dtv; DecodeThreadVars dtv;
@ -2777,6 +2778,7 @@ end:
DetectEngineCtxFree(de_ctx); DetectEngineCtxFree(de_ctx);
} }
if (p != NULL)
SCFree(p); SCFree(p);
return result; return result;
} }

@ -9391,6 +9391,10 @@ static int SigTestWithinReal01 (int mpm_type) {
DecodeThreadVars dtv; DecodeThreadVars dtv;
ThreadVars th_v; ThreadVars th_v;
int result = 0; int result = 0;
Packet *p1 = NULL;
Packet *p2 = NULL;
Packet *p3 = NULL;
Packet *p4 = NULL;
uint8_t rawpkt1[] = { uint8_t rawpkt1[] = {
0x00,0x04,0x76,0xd3,0xd8,0x6a,0x00,0x24, 0x00,0x04,0x76,0xd3,0xd8,0x6a,0x00,0x24,
@ -9505,7 +9509,7 @@ static int SigTestWithinReal01 (int mpm_type) {
DetectEngineThreadCtxInit(&th_v, (void *)de_ctx, (void *)&det_ctx); DetectEngineThreadCtxInit(&th_v, (void *)de_ctx, (void *)&det_ctx);
/* packet 1 */ /* packet 1 */
Packet *p1 = SCMalloc(SIZE_OF_PACKET); p1 = SCMalloc(SIZE_OF_PACKET);
if (p1 == NULL) if (p1 == NULL)
return 0; return 0;
memset(p1, 0, SIZE_OF_PACKET); memset(p1, 0, SIZE_OF_PACKET);
@ -9518,7 +9522,7 @@ static int SigTestWithinReal01 (int mpm_type) {
} }
/* packet 2 */ /* packet 2 */
Packet *p2 = SCMalloc(SIZE_OF_PACKET); p2 = SCMalloc(SIZE_OF_PACKET);
if (p2 == NULL) if (p2 == NULL)
return 0; return 0;
memset(p2, 0, SIZE_OF_PACKET); memset(p2, 0, SIZE_OF_PACKET);
@ -9531,7 +9535,7 @@ static int SigTestWithinReal01 (int mpm_type) {
} }
/* packet 3 */ /* packet 3 */
Packet *p3 = SCMalloc(SIZE_OF_PACKET); p3 = SCMalloc(SIZE_OF_PACKET);
if (p3 == NULL) if (p3 == NULL)
return 0; return 0;
memset(p3, 0, SIZE_OF_PACKET); memset(p3, 0, SIZE_OF_PACKET);
@ -9544,7 +9548,7 @@ static int SigTestWithinReal01 (int mpm_type) {
} }
/* packet 4 */ /* packet 4 */
Packet *p4 = SCMalloc(SIZE_OF_PACKET); p4 = SCMalloc(SIZE_OF_PACKET);
if (p4 == NULL) if (p4 == NULL)
return 0; return 0;
memset(p4, 0, SIZE_OF_PACKET); memset(p4, 0, SIZE_OF_PACKET);
@ -9581,9 +9585,13 @@ end:
DetectEngineCtxFree(de_ctx); DetectEngineCtxFree(de_ctx);
FlowShutdown(); FlowShutdown();
if (p1 != NULL)
SCFree(p1); SCFree(p1);
if (p2 != NULL)
SCFree(p2); SCFree(p2);
if (p3 != NULL)
SCFree(p3); SCFree(p3);
if (p4 != NULL)
SCFree(p4); SCFree(p4);
return result; return result;
} }

Loading…
Cancel
Save