Skip to content
Snippets Groups Projects
Commit 0d0af79e authored by Lubos Slovak's avatar Lubos Slovak
Browse files

Changed the order of deleting zone trees.

- NSEC3 tree must be deleted before the normal tree, as the RDATA
  in it may contain domain names from the normal tree and checking
  them would otherwise result in undefined behaviour (as those
  names will already be deleted).
parent a28292e5
No related branches found
No related tags found
No related merge requests found
......@@ -988,17 +988,19 @@ void dnslib_zone_deep_free(dnslib_zone_t **zone)
#endif
/* has to go through zone twice, rdata may contain references to node
owners earlier in the zone which may be already freed */
/* NSEC3 tree is deleted first as it may contain references to the
normal tree. */
TREE_POST_ORDER_APPLY((*zone)->tree, dnslib_node, avl,
TREE_POST_ORDER_APPLY((*zone)->nsec3_nodes, dnslib_node, avl,
dnslib_zone_destroy_node_rrsets_from_tree, NULL);
TREE_POST_ORDER_APPLY((*zone)->tree, dnslib_node, avl,
TREE_POST_ORDER_APPLY((*zone)->nsec3_nodes, dnslib_node, avl,
dnslib_zone_destroy_node_owner_from_tree, NULL);
TREE_POST_ORDER_APPLY((*zone)->nsec3_nodes, dnslib_node, avl,
TREE_POST_ORDER_APPLY((*zone)->tree, dnslib_node, avl,
dnslib_zone_destroy_node_rrsets_from_tree, NULL);
TREE_POST_ORDER_APPLY((*zone)->nsec3_nodes, dnslib_node, avl,
TREE_POST_ORDER_APPLY((*zone)->tree, dnslib_node, avl,
dnslib_zone_destroy_node_owner_from_tree, NULL);
dnslib_zone_free(zone);
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment