summaryrefslogtreecommitdiffstats
path: root/lib/table.h
diff options
context:
space:
mode:
authorDonald Sharp <sharpd@cumulusnetworks.com>2018-07-27 15:54:39 +0200
committerDonald Sharp <sharpd@cumulusnetworks.com>2018-07-27 15:54:39 +0200
commit563f0c2b2de19737e62017d318a7f5cdbbf8c210 (patch)
treeae51b502f8810802d26446152be9e64fc4ed929e /lib/table.h
parentMerge pull request #2708 from ton31337/feature/default-originate_apply_route-... (diff)
downloadfrr-563f0c2b2de19737e62017d318a7f5cdbbf8c210.tar.xz
frr-563f0c2b2de19737e62017d318a7f5cdbbf8c210.zip
lib: Modify route unlock code to return appropriate pointer
Modify the unlock code for a route_node to return NULL on pointer freed or to return the node itself again. We'll need to go through the code and fix this pattern, but this is a problem for another day. Get this fix in place and we can make it a low hanging problem to fix. Signed-off-by: Donald Sharp <sharpd@cumulusnetworks.com>
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 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;
}
/*