diff --git a/src/flow.h b/src/flow.h index 5a44307b0f..6ede7c6b2a 100644 --- a/src/flow.h +++ b/src/flow.h @@ -521,8 +521,17 @@ static inline void FlowDecrUsecnt(Flow *f) (void) SC_ATOMIC_SUB(f->use_cnt, 1); } +/** \brief Reference the flow, bumping the flows use_cnt + * \note This should only be called once for a destination + * pointer */ static inline void FlowReference(Flow **d, Flow *f) { if (likely(f != NULL)) { +#ifdef DEBUG_VALIDATION + BUG_ON(*d == f); +#else + if (*d == f) + return; +#endif FlowIncrUsecnt(f); *d = f; }