From 8b1af054e8b6b9fae0a597a41c297f655bd3483a Mon Sep 17 00:00:00 2001 From: "Alexander V. Chernikov" Date: Wed, 1 Oct 2014 21:24:58 +0000 Subject: [PATCH] Free radix mask entries on main radix destroy. This is temporary commit to be merged to 10. Other approach (like hash table) should be used to store different masks. PR: 194078 Submitted by: Rumen Telbizov MFC after: 3 days --- sys/net/radix.c | 13 +++++++++++++ 1 file changed, 13 insertions(+) diff --git a/sys/net/radix.c b/sys/net/radix.c index 98a18004dc41..0447cba6f665 100644 --- a/sys/net/radix.c +++ b/sys/net/radix.c @@ -1178,6 +1178,18 @@ rn_inithead(void **head, int off) return (1); } +static int +rn_freeentry(struct radix_node *rn, void *arg) +{ + struct radix_node_head * const rnh = arg; + struct radix_node *x; + + x = (struct radix_node *)rn_delete(rn + 2, NULL, rnh); + if (x != NULL) + Free(x); + return (0); +} + int rn_detachhead(void **head) { @@ -1188,6 +1200,7 @@ rn_detachhead(void **head) rnh = *head; + rn_walktree(rnh->rnh_masks, rn_freeentry, rnh->rnh_masks); rn_detachhead_internal((void **)&rnh->rnh_masks); rn_detachhead_internal(head); return (1);