]> 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 049f993a6330b85238ec087a237280a77f0287a2..2f0e510dfc39b7257768382d9cd8734b78390526 100644 (file)
@@ -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;
 }