Properly cleanup used mutexes and condition vars in the flow subsys.

remotes/origin/master-1.0.x
Victor Julien 15 years ago
parent 38f7479af2
commit ae2698c9cc

@ -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) {

@ -22,6 +22,7 @@ typedef struct FlowQueue_
/* prototypes */
FlowQueue *FlowQueueNew();
FlowQueue *FlowQueueInit(FlowQueue *);
void FlowQueueDestroy (FlowQueue *);
void FlowEnqueue (FlowQueue *, Flow *);
Flow *FlowDequeue (FlowQueue *);

@ -1,5 +1,9 @@
/** Copyright (c) 2008 Victor Julien <victor@inliniac.net>
/* Copyright (c) 2008, 2009, 2010 Victor Julien <victor@inliniac.net> */
/**
* \file
* \author Victor Julien <victor@inliniac.net>
*
* 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);
}

@ -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) ({ \

Loading…
Cancel
Save