diff --git a/src/flow-queue.c b/src/flow-queue.c index d642998dad..5a5894200a 100644 --- a/src/flow-queue.c +++ b/src/flow-queue.c @@ -29,6 +29,16 @@ FlowQueue *FlowQueueInit (FlowQueue *q) { return q; } +/** + * \brief Destroy a flow queue + * + * \param q the flow queue to destroy + */ +void FlowQueueDestroy (FlowQueue *q) { + SCMutexDestroy(&q->mutex_q); + SCCondDestroy(&q->cond_q); +} + void FlowEnqueue (FlowQueue *q, Flow *f) { /* more packets in queue */ if (q->top != NULL) { diff --git a/src/flow-queue.h b/src/flow-queue.h index 9e0258508a..d0c4a04fca 100644 --- a/src/flow-queue.h +++ b/src/flow-queue.h @@ -22,6 +22,7 @@ typedef struct FlowQueue_ /* prototypes */ FlowQueue *FlowQueueNew(); FlowQueue *FlowQueueInit(FlowQueue *); +void FlowQueueDestroy (FlowQueue *); void FlowEnqueue (FlowQueue *, Flow *); Flow *FlowDequeue (FlowQueue *); diff --git a/src/flow.c b/src/flow.c index fcf90d90e9..55eaa1119f 100644 --- a/src/flow.c +++ b/src/flow.c @@ -1,5 +1,9 @@ -/** Copyright (c) 2008 Victor Julien +/* Copyright (c) 2008, 2009, 2010 Victor Julien */ + +/** * \file + * \author Victor Julien + * * Flow implementation. * * IDEAS: @@ -608,6 +612,14 @@ void FlowShutdown(void) { } flow_memuse -= flow_config.hash_size * sizeof(FlowBucket); + int ifq = 0; + FlowQueueDestroy(&flow_spare_q); + for (ifq = 0; ifq < FLOW_PROTO_MAX; ifq++) { + FlowQueueDestroy(&flow_new_q[ifq]); + FlowQueueDestroy(&flow_est_q[ifq]); + FlowQueueDestroy(&flow_close_q[ifq]); + } + SCMutexDestroy(&flow_memuse_mutex); } diff --git a/src/threads.h b/src/threads.h index bdd2d184ba..7f4c59bc84 100644 --- a/src/threads.h +++ b/src/threads.h @@ -185,6 +185,7 @@ #define SCCondInit pthread_cond_init #define SCCondSignal pthread_cond_signal #define SCCondTimedwait pthread_cond_timedwait +#define SCCondDestroy pthread_cond_destroy #ifdef DBG_THREAD #define SCondWait_dbg(cond, mut) ({ \