From 3409513a44efe4b703b238f87d7cc57fd0e587ca Mon Sep 17 00:00:00 2001 From: Victor Julien Date: Thu, 30 Dec 2010 19:45:53 +0100 Subject: [PATCH] Fix FlowTest* unittests to fail sometimes. --- src/flow.c | 25 +++++++++++++++++++++---- 1 file changed, 21 insertions(+), 4 deletions(-) diff --git a/src/flow.c b/src/flow.c index d955529157..a181a28183 100644 --- a/src/flow.c +++ b/src/flow.c @@ -1577,6 +1577,8 @@ static int FlowTest03 (void) { FlowBucket fb; struct timeval ts; + FlowQueueInit(&flow_spare_q); + memset(&ssn, 0, sizeof(TcpSession)); memset(&f, 0, sizeof(Flow)); memset(&ts, 0, sizeof(ts)); @@ -1596,11 +1598,14 @@ static int FlowTest03 (void) { if (FlowTestPrune(&f, &ts) != 1) { SCSpinDestroy(&fb.s); FLOW_DESTROY(&f); + FlowQueueDestroy(&flow_spare_q); return 0; } SCSpinDestroy(&fb.s); - //FLOW_DESTROY(&f); + FLOW_DESTROY(&f); + + FlowQueueDestroy(&flow_spare_q); return 1; } @@ -1621,6 +1626,8 @@ static int FlowTest04 (void) { TcpStream client; uint8_t payload[3] = {0x41, 0x41, 0x41}; + FlowQueueInit(&flow_spare_q); + memset(&ssn, 0, sizeof(TcpSession)); memset(&f, 0, sizeof(Flow)); memset(&fb, 0, sizeof(FlowBucket)); @@ -1648,10 +1655,12 @@ static int FlowTest04 (void) { if (FlowTestPrune(&f, &ts) != 1) { SCSpinDestroy(&fb.s); FLOW_DESTROY(&f); + FlowQueueDestroy(&flow_spare_q); return 0; } SCSpinDestroy(&fb.s); - //FLOW_DESTROY(&f); + FLOW_DESTROY(&f); + FlowQueueDestroy(&flow_spare_q); return 1; } @@ -1670,6 +1679,8 @@ static int FlowTest05 (void) { FlowBucket fb; struct timeval ts; + FlowQueueInit(&flow_spare_q); + memset(&ssn, 0, sizeof(TcpSession)); memset(&f, 0, sizeof(Flow)); memset(&ts, 0, sizeof(ts)); @@ -1689,11 +1700,13 @@ static int FlowTest05 (void) { if (FlowTestPrune(&f, &ts) != 1) { SCSpinDestroy(&fb.s); FLOW_DESTROY(&f); + FlowQueueDestroy(&flow_spare_q); return 0; } SCSpinDestroy(&fb.s); - //FLOW_DESTROY(&f); + FLOW_DESTROY(&f); + FlowQueueDestroy(&flow_spare_q); return 1; } @@ -1714,6 +1727,8 @@ static int FlowTest06 (void) { TcpStream client; uint8_t payload[3] = {0x41, 0x41, 0x41}; + FlowQueueInit(&flow_spare_q); + memset(&ssn, 0, sizeof(TcpSession)); memset(&f, 0, sizeof(Flow)); memset(&fb, 0, sizeof(FlowBucket)); @@ -1742,11 +1757,13 @@ static int FlowTest06 (void) { if (FlowTestPrune(&f, &ts) != 1) { SCSpinDestroy(&fb.s); FLOW_DESTROY(&f); + FlowQueueDestroy(&flow_spare_q); return 0; } SCSpinDestroy(&fb.s); - //FLOW_DESTROY(&f); + FLOW_DESTROY(&f); + FlowQueueDestroy(&flow_spare_q); return 1; }