Add KASSERT() to mbuf free routines in order to allow developers to

catch cases where the mbuf has already been freed.
Submitted by:	David Malone <dwmalone@maths.tcd.ie>
PR:		kern/18471
This commit is contained in:
Jonathan Lemon 2000-06-10 18:00:27 +00:00
parent 6776c7cba9
commit 55eecff6e7

View File

@ -381,6 +381,7 @@ union mcluster {
#define MCLFREE1(p) do { \
union mcluster *_mp = (union mcluster *)(p); \
\
KASSERT(mclrefcnt[mtocl(_mp)] > 0, ("freeing free cluster")); \
if (--mclrefcnt[mtocl(_mp)] == 0) { \
_mp->mcl_next = mclfree; \
mclfree = _mp; \
@ -415,6 +416,7 @@ union mcluster {
#define MFREE(m, n) MBUFLOCK( \
struct mbuf *_mm = (m); \
\
KASSERT(_mm->m_type != MT_FREE, ("freeing free mbuf")); \
mbstat.m_mtypes[_mm->m_type]--; \
if (_mm->m_flags & M_EXT) \
MEXTFREE1(m); \