From 384d4156a51fac86ce230da21597bd942b992895 Mon Sep 17 00:00:00 2001 From: Nuno Antunes Date: Thu, 17 Jul 2014 07:51:24 +0100 Subject: [PATCH] netgraph7: Assert the refcount is zero when freeing the item. --- sys/netgraph7/netgraph/ng_base.c | 5 +++++ 1 file changed, 5 insertions(+) diff --git a/sys/netgraph7/netgraph/ng_base.c b/sys/netgraph7/netgraph/ng_base.c index 5f60666968..6b8dfcde4f 100644 --- a/sys/netgraph7/netgraph/ng_base.c +++ b/sys/netgraph7/netgraph/ng_base.c @@ -2613,6 +2613,11 @@ ng_free_item(item_p item) */ KASSERT(item->apply == NULL, ("freeing item with registered callback")); + /* + * Make sure the reference count has reached zero. + */ + KASSERT(item->refs == 0, ("freeing item with non-zero refcount")); + /* * The item may hold resources on it's own. We need to free * these before we can free the item. What they are depends upon -- 2.41.0