from last update.
#endif
+/* \todo there is another copy of this same macro inside flow-util.h. The
+ * reason we have this duplicate is because we couldn't solve endless
+ * header files cross-reference. */
+#define FlowDeReference(src_f_ptr) do { \
+ if (*(src_f_ptr) != NULL) { \
+ FlowDecrUsecnt(*(src_f_ptr)); \
+ *(src_f_ptr) = NULL; \
+ } \
+ } while (0)
+
/**
* \brief Recycle a packet structure for reuse.
* \todo the mutex destroy & init is necessary because of the memset, reconsider
(p)->flags = 0; \
(p)->flowflags = 0; \
(p)->pkt_src = 0; \
- (p)->flow = NULL; \
+ FlowDeReference(&((p)->flow)); \
(p)->ts.tv_sec = 0; \
(p)->ts.tv_usec = 0; \
(p)->datalink = 0; \
} \
} while (0)
+/* \todo there is another copy of this same macro inside decode.h. The reason
+ * we have this duplicate is because we couldn't solve endless header
+ * files cross-reference. */
#define FlowDeReference(src_f_ptr) do { \
if (*(src_f_ptr) != NULL) { \
FlowDecrUsecnt(*(src_f_ptr)); \
SCLogDebug("returning smsg %p to pool", smsg);
smsg->next = NULL;
smsg->prev = NULL;
- smsg->flow = NULL;
+ FlowDeReference(&smsg->flow);
StreamMsgReturnToPool(smsg);
smsg = smsg_next;
}
SCLogDebug("returning smsg %p to pool", smsg);
smsg->next = NULL;
smsg->prev = NULL;
- smsg->flow = NULL;
+ FlowDeReference(&smsg->flow);
StreamMsgReturnToPool(smsg);
smsg = smsg_next;
}
SCLogDebug("returning smsg %p to pool", smsg);
smsg->next = NULL;
smsg->prev = NULL;
- smsg->flow = NULL;
+ FlowDeReference(&smsg->flow);
StreamMsgReturnToPool(smsg);
smsg = smsg_next;
}
SCLogDebug("returning smsg %p to pool", smsg);
smsg->next = NULL;
smsg->prev = NULL;
- smsg->flow = NULL;
+ FlowDeReference(&smsg->flow);
StreamMsgReturnToPool(smsg);
smsg = smsg_next;
}
#include "util-pool.h"
#include "util-debug.h"
#include "stream-tcp.h"
+#include "flow-util.h"
#ifdef DEBUG
static SCMutex stream_pool_memuse_mutex;
SCLogDebug("returning smsg %p to pool", smsg);
smsg->next = NULL;
smsg->prev = NULL;
- smsg->flow = NULL;
+ FlowDeReference(&smsg->flow);
StreamMsgReturnToPool(smsg);
smsg = smsg_next;
}
#include "threads.h"
#include "threadvars.h"
#include "flow.h"
+#include "flow-util.h"
#include "stream.h"
#include "stream-tcp-reassemble.h"
SCLogDebug("tunnel stuff done, move on (proot %d)", proot);
}
- FlowDecrUsecnt(p->flow);
+ FlowDeReference(&p->flow);
/* we're done with the tunnel root now as well */
if (proot == 1) {
SCLogDebug("getting rid of root pkt... alloc'd %s", p->root->flags & PKT_ALLOC ? "true" : "false");
- FlowDecrUsecnt(p->root->flow);
+ FlowDeReference(&p->root->flow);
/* if p->root uses extended data, free them */
if (p->root->ReleaseData) {
if (p->root->ReleaseData(t, p->root) == TM_ECODE_FAILED) {