summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
-rw-r--r--lib/table.h8
1 files changed, 6 insertions, 2 deletions
diff --git a/lib/table.h b/lib/table.h
index a9d788b35..f58a6025e 100644
--- a/lib/table.h
+++ b/lib/table.h
@@ -233,13 +233,17 @@ static inline struct route_node *route_lock_node(struct route_node *node)
}
/* Unlock node. */
-static inline void route_unlock_node(struct route_node *node)
+static inline struct route_node *route_unlock_node(struct route_node *node)
{
assert(node->lock > 0);
(*(unsigned *)&node->lock)--;
- if (node->lock == 0)
+ if (node->lock == 0) {
route_node_delete(node);
+ return NULL;
+ }
+
+ return node;
}
/*