]> jfr.im git - irc/quakenet/newserv.git/blobdiff - patricia/patricia.c
move some more data/log paths missed before
[irc/quakenet/newserv.git] / patricia / patricia.c
index 526d8f3ba25fbe83e1a9cf3d041981e7fe9f7b80..2f0e510dfc39b7257768382d9cd8734b78390526 100644 (file)
@@ -36,7 +36,7 @@ void patriciastats(int hooknum, void *arg) {
   patricia_node_t *head, *node;
   int i,j,k,l;
 
-  if (level < 5) 
+  if (level <= 5) 
     return; 
 
   sprintf(buf, "Patricia: %6d Active Nodes (%d bits)", iptree->num_active_node, iptree->maxbits);
@@ -121,9 +121,18 @@ void releasenodeext(int index) {
 
   head = iptree->head;
 
-  PATRICIA_WALK_ALL(head, node)
+  PATRICIA_WALK_CLEAR(head, node)
   {
-      node->exts[index]=NULL;
-  } PATRICIA_WALK_END;
+    if ( node->exts[index] ) { 
+      if (node->prefix) {
+        if (node->prefix->ref_count == 1) {
+          patricia_remove(iptree, node);
+        } else {
+          patricia_deref_prefix(node->prefix);
+        }
+      }
+    }
+    node->exts[index]=NULL;
+  } PATRICIA_WALK_CLEAR_END;
 }