Commit 11ebfbe4 authored by Dominik Taborsky's avatar Dominik Taborsky

zone-api: fix update cleanup.

parent 0ea96986
......@@ -157,7 +157,6 @@ static int process_normal(zone_t *zone, list_t *requests)
// Apply changes.
zone_contents_t *new_contents = NULL;
ret = zone_update_commit(&up, &new_contents);
zone_update_clear(&up);
if (ret != KNOT_EOK) {
if (ret == KNOT_ETTL) {
set_rcodes(requests, KNOT_RCODE_REFUSED);
......@@ -183,6 +182,8 @@ static int process_normal(zone_t *zone, list_t *requests)
update_free_zone(&old_contents);
}
zone_update_clear(&up);
/* Sync zonefile immediately if configured. */
conf_val_t val = conf_zone_get(conf(), C_ZONEFILE_SYNC, zone->name);
if (conf_int(&val) == 0) {
......
......@@ -253,6 +253,7 @@ const knot_rdataset_t *zone_update_to(zone_update_t *update)
void zone_update_clear(zone_update_t *update)
{
if (update) {
update_cleanup(&update->change);
changeset_clear(&update->change);
mp_delete(update->mm.ctx);
memset(update, 0, sizeof(*update));
......@@ -437,9 +438,6 @@ static int commit_incremental(zone_update_t *update, zone_contents_t **contents_
return ret;
}
update_cleanup(&update->change);
changeset_clear(&update->change);
*contents_out = new_contents;
return KNOT_EOK;
......
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