summaryrefslogtreecommitdiff
path: root/lib/table.h
diff options
context:
space:
mode:
Diffstat (limited to 'lib/table.h')
-rw-r--r--lib/table.h8
1 files changed, 6 insertions, 2 deletions
diff --git a/lib/table.h b/lib/table.h
index 8304abe59b..ac7df3e695 100644
--- a/lib/table.h
+++ b/lib/table.h
@@ -235,13 +235,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;
}
/*