Usually we only mark nodes as deleted, but finally, we should actually
delete what we can as we keep the pointers for back referencing.
Signed-off-by: Michael Tremer <michael.tremer@ipfire.org>
// Return for nodes that have already been deleted
if (n->deleted)
- return 1;
+ goto DELETE;
// Delete zero
if (n->zero) {
if (!r0 || !r1)
return 0;
- // If is safe to delete this node
- n->deleted = 1;
+DELETE:
+ // It is now safe to delete the node
+ loc_network_tree_node_unref(n);
+ *node = NULL;
return 1;
}