Commit e99601a7 authored by Dominik Taborsky's avatar Dominik Taborsky

apply: avoid deleting apex node when empty as it will be replaced

parent 97ea5cf8
......@@ -182,7 +182,7 @@ static int remove_rr(apply_ctx_t *ctx, zone_tree_t *tree, zone_node_t *node,
// RRSet is empty now, remove it from node, all data freed.
node_remove_rdataset(node, rr->type);
// If node is empty now, delete it from zone tree.
if (node->rrset_count == 0) {
if (node->rrset_count == 0 && node != ctx->apex) {
zone_tree_delete_empty_node(tree, node);
}
}
......@@ -320,6 +320,8 @@ static int apply_single(apply_ctx_t *ctx, zone_contents_t *contents, changeset_t
return KNOT_EINVAL;
}
ctx->apex = contents->apex;
int ret = apply_remove(ctx, contents, chset);
if (ret != KNOT_EOK) {
return ret;
......
......@@ -31,6 +31,7 @@
struct apply_ctx {
list_t old_data; /*!< Old data, to be freed after successful update. */
list_t new_data; /*!< New data, to be freed after failed update. */
zone_node_t *apex;
};
typedef struct apply_ctx apply_ctx_t;
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment