summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorglebius <glebius@FreeBSD.org>2014-10-16 20:46:02 +0000
committerglebius <glebius@FreeBSD.org>2014-10-16 20:46:02 +0000
commit9ea3e686268d309beb7761505ed662a69dc424b5 (patch)
treedbcac6a88cee0a62512536fc5dc476672f6217bb
parent86f98e492eebb0155d25616d87c39cae90ec0723 (diff)
downloadFreeBSD-src-9ea3e686268d309beb7761505ed662a69dc424b5.zip
FreeBSD-src-9ea3e686268d309beb7761505ed662a69dc424b5.tar.gz
Merge r272385 by melifaro from head:
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
-rw-r--r--sys/net/radix.c13
1 files changed, 13 insertions, 0 deletions
diff --git a/sys/net/radix.c b/sys/net/radix.c
index 5bf9dff..b715398 100644
--- a/sys/net/radix.c
+++ b/sys/net/radix.c
@@ -1204,6 +1204,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)
{
@@ -1214,6 +1226,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);
OpenPOWER on IntegriCloud