summaryrefslogtreecommitdiff
path: root/lib/table.c
diff options
context:
space:
mode:
Diffstat (limited to 'lib/table.c')
-rw-r--r--lib/table.c10
1 files changed, 9 insertions, 1 deletions
diff --git a/lib/table.c b/lib/table.c
index f80f3e81f0..075c5584a8 100644
--- a/lib/table.c
+++ b/lib/table.c
@@ -28,7 +28,7 @@
#include "sockunion.h"
DEFINE_MTYPE( LIB, ROUTE_TABLE, "Route table")
-DEFINE_MTYPE_STATIC(LIB, ROUTE_NODE, "Route node")
+DEFINE_MTYPE( LIB, ROUTE_NODE, "Route node")
static void route_node_delete (struct route_node *);
static void route_table_free (struct route_table *);
@@ -400,6 +400,14 @@ route_node_delete (struct route_node *node)
node->table->count--;
+ /* WARNING: FRAGILE CODE!
+ * route_node_free may have the side effect of free'ing the entire table.
+ * this is permitted only if table->count got decremented to zero above,
+ * because in that case parent will also be NULL, so that we won't try to
+ * delete a now-stale parent below.
+ *
+ * cf. srcdest_srcnode_destroy() in zebra/zebra_rib.c */
+
route_node_free (node->table, node);
/* If parent node is stub then delete it also. */