Commit 61b3df1c authored by Jan Včelák's avatar Jan Včelák 🚀

remove unused argument from knot_rrset_deep_free() calls

Coccinelle patch performing most changes included.
parent 0ebe0d48
//
// Remove third argument from knot_rrset_deep_free{,no_sig}() calls
//
@@
expression E1, E2, E3;
@@
(
knot_rrset_deep_free
|
knot_rrset_deep_free_no_sig
)
(E1, E2
- , E3
)
......@@ -222,7 +222,7 @@ static int cmd_remote(const char *cmd, uint16_t rrt, int argc, char *argv[])
}
if (knot_packet_to_wire(qr, &buf, &buflen) != KNOT_EOK) {
knot_rrset_deep_free(&rr, 1, 1);
knot_rrset_deep_free(&rr, 1);
knot_packet_free(&qr);
return 1;
}
......@@ -258,7 +258,7 @@ static int cmd_remote(const char *cmd, uint16_t rrt, int argc, char *argv[])
/* Cleanup. */
if (rc == 0) printf("\n");
knot_rrset_deep_free(&rr, 1, 1);
knot_rrset_deep_free(&rr, 1);
/* Close connection. */
socket_close(s);
......
......@@ -533,13 +533,13 @@ static int remote_send_chunk(int c, knot_packet_t *pkt, const char* d,
size_t rrlen = rlen;
ret = knot_rrset_to_wire(rr, rwire + len, &rrlen, rlen, &rr_count, NULL);
if (ret != KNOT_EOK) {
knot_rrset_deep_free(&rr, 1, 1);
knot_rrset_deep_free(&rr, 1);
return ret;
}
knot_wire_set_nscount(rwire, rr_count);
len += rrlen;
rlen -= rrlen;
knot_rrset_deep_free(&rr, 1, 1);
knot_rrset_deep_free(&rr, 1);
if (len > 0) {
return tcp_send(c, rwire, len);
......
......@@ -782,7 +782,7 @@ int zones_changesets_from_binary(knot_changesets_t *chgsets)
} else {
/* Final SOA. */
dbg_xfr_verb("xfr: extra SOA\n");
knot_rrset_deep_free(&rrset, 1, 1);
knot_rrset_deep_free(&rrset, 1);
break;
}
} else {
......@@ -1083,7 +1083,7 @@ static void zones_free_merged_changesets(knot_changesets_t *diff_chs,
* thus must be freed
*/
knot_rrset_deep_free_no_sig(
&(knot_changesets_get_last(sec_chs)->soa_from), 1, 1);
&(knot_changesets_get_last(sec_chs)->soa_from), 1);
// Reset sec_chs' chngeset list, else we'd double free.
init_list(&sec_chs->sets);
......
......@@ -144,7 +144,7 @@ static int find_rrset_for_rrsig_in_node(knot_zone_contents_t *zone,
return KNOT_EINVAL;
} else if (ret > 0) {
/* Merged, free data + owner, but not DNAMEs inside RDATA. */
knot_rrset_deep_free(&rrsig, 1, 0);
knot_rrset_deep_free(&rrsig, 1);
}
assert(tmp_rrset->rrsigs != NULL);
......@@ -303,7 +303,7 @@ static void process_rr(const scanner_t *scanner)
} else {
log_zone_warning("encountered identical "
"extra SOA record\n");
knot_rrset_deep_free(&current_rrset, 1, 1);
knot_rrset_deep_free(&current_rrset, 1);
parser->ret = KNOT_EOK;
return;
}
......@@ -452,7 +452,7 @@ static void process_rr(const scanner_t *scanner)
parser->ret = ret;
return;
} else if (ret > 0) {
knot_rrset_deep_free(&current_rrset, 1, 0);
knot_rrset_deep_free(&current_rrset, 1);
}
assert(parser->current_zone && node);
/* Do mandatory semantic checks. */
......
......@@ -191,7 +191,7 @@ int knot_sig0_sign(uint8_t *wire, size_t *wire_size, size_t wire_max_size,
uint8_t *sig_rdata = sig0_create_rdata(sig_rrset, key);
if (!sig_rdata) {
knot_rrset_deep_free(&sig_rrset, 1, 0);
knot_rrset_deep_free(&sig_rrset, 1);
return KNOT_ENOMEM;
}
......@@ -207,7 +207,7 @@ int knot_sig0_sign(uint8_t *wire, size_t *wire_size, size_t wire_max_size,
int result = knot_rrset_to_wire(sig_rrset, wire_end, &wire_sig_size,
wire_avail_size, &written_rr_count,
NULL);
knot_rrset_deep_free(&sig_rrset, 1, 0);
knot_rrset_deep_free(&sig_rrset, 1);
if (result != KNOT_EOK) {
return result;
}
......
......@@ -140,8 +140,8 @@ static int changeset_remove_nsec(const knot_rrset_t *oldrr,
result = knot_changeset_add_rrset(changeset, old_nsec,
KNOT_CHANGESET_REMOVE);
if (result != KNOT_EOK) {
knot_rrset_deep_free(&old_nsec, 1, 1);
knot_rrset_deep_free(&old_rrsigs, 1, 1);
knot_rrset_deep_free(&old_nsec, 1);
knot_rrset_deep_free(&old_rrsigs, 1);
return result;
}
......@@ -149,7 +149,7 @@ static int changeset_remove_nsec(const knot_rrset_t *oldrr,
result = knot_changeset_add_rrset(changeset, old_rrsigs,
KNOT_CHANGESET_REMOVE);
if (result != KNOT_EOK) {
knot_rrset_deep_free(&old_rrsigs, 1, 1);
knot_rrset_deep_free(&old_rrsigs, 1);
return result;
}
}
......@@ -264,7 +264,7 @@ static int connect_nsec_nodes(knot_node_t *a, knot_node_t *b, void *d)
KNOT_RRSET_COMPARE_WHOLE)) {
// current NSEC is valid, do nothing
dbg_dnssec_detail("NSECs equal.\n");
knot_rrset_deep_free(&new_nsec, 1, 1);
knot_rrset_deep_free(&new_nsec, 1);
return KNOT_EOK;
}
......@@ -274,7 +274,7 @@ static int connect_nsec_nodes(knot_node_t *a, knot_node_t *b, void *d)
knot_node_set_replaced_nsec(a);
ret = changeset_remove_nsec(old_nsec, data->changeset);
if (ret != KNOT_EOK) {
knot_rrset_deep_free(&new_nsec, 1, 1);
knot_rrset_deep_free(&new_nsec, 1);
return ret;
}
}
......@@ -774,7 +774,7 @@ static void free_nsec3_tree(knot_zone_tree_t *nodes)
// referenced RRSIGs from old NSEC3 tree
node->rrset_tree[i]->rrsigs = NULL;
// newly allocated NSEC3 nodes
knot_rrset_deep_free(&node->rrset_tree[i], 1, 1);
knot_rrset_deep_free(&node->rrset_tree[i], 1);
}
knot_node_free(&node);
......
......@@ -226,8 +226,7 @@ static int remove_expired_rrsigs(const knot_rrset_t *covered,
if (to_remove != NULL && result != KNOT_EOK) {
int free_owners = true;
int free_rdata_dnames = true;
knot_rrset_deep_free(&to_remove, free_owners, free_rdata_dnames);
knot_rrset_deep_free(&to_remove, free_owners);
}
return result;
......@@ -289,8 +288,7 @@ static int add_missing_rrsigs(const knot_rrset_t *covered,
if (to_add != NULL && result != KNOT_EOK) {
int free_owners = true;
int free_rdata_dnames = true;
knot_rrset_deep_free(&to_add, free_owners, free_rdata_dnames);
knot_rrset_deep_free(&to_add, free_owners);
}
return result;
......@@ -746,7 +744,7 @@ done:
}
if (to_remove != NULL && result != KNOT_EOK) {
knot_rrset_deep_free(&to_remove, 1, 1);
knot_rrset_deep_free(&to_remove, 1);
}
return result;
......@@ -824,7 +822,7 @@ static int add_missing_dnskeys(const knot_rrset_t *soa,
}
if (to_add != NULL && result != KNOT_EOK) {
knot_rrset_deep_free(&to_add, 1, 1);
knot_rrset_deep_free(&to_add, 1);
}
return result;
......@@ -887,7 +885,7 @@ static int update_dnskeys_rrsigs(const knot_rrset_t *dnskeys,
fail:
knot_rrset_deep_free(&new_dnskeys, 1, 1);
knot_rrset_deep_free(&new_dnskeys, 1);
return result;
}
......@@ -1073,7 +1071,7 @@ int knot_zone_sign_update_soa(const knot_rrset_t *soa,
result = knot_changeset_add_rrset(changeset, soa_copy,
KNOT_CHANGESET_REMOVE);
if (result != KNOT_EOK) {
knot_rrset_deep_free(&soa_copy, 1, 1);
knot_rrset_deep_free(&soa_copy, 1);
return result;
}
}
......@@ -1090,7 +1088,7 @@ int knot_zone_sign_update_soa(const knot_rrset_t *soa,
result = knot_rrset_deep_copy_no_sig(soa, &soa_to);
if (result != KNOT_EOK) {
knot_rrset_deep_free(&soa_from, 1, 1);
knot_rrset_deep_free(&soa_from, 1);
return result;
}
......@@ -1100,8 +1098,8 @@ int knot_zone_sign_update_soa(const knot_rrset_t *soa,
result = add_missing_rrsigs(soa_to, NULL, zone_keys, policy, changeset);
if (result != KNOT_EOK) {
knot_rrset_deep_free(&soa_from, 1, 1);
knot_rrset_deep_free(&soa_to, 1, 1);
knot_rrset_deep_free(&soa_from, 1);
knot_rrset_deep_free(&soa_to, 1);
return result;
}
......
......@@ -73,7 +73,7 @@ static knot_rrset_t *create_txt_rrset(const knot_dname_t *owner,
uint8_t *rdata = knot_rrset_create_rdata(rrset, response_len + 1);
if (!rdata) {
knot_rrset_deep_free(&rrset, 1, 0);
knot_rrset_deep_free(&rrset, 1);
return NULL;
}
......@@ -103,17 +103,17 @@ static int answer_txt(knot_nameserver_t *nameserver, knot_packet_t *response,
int result = knot_response_add_rrset_answer(response, rrset, 1, 0, 0);
if (result != KNOT_EOK) {
knot_rrset_deep_free(&rrset, 1, 0);
knot_rrset_deep_free(&rrset, 1);
return KNOT_RCODE_SERVFAIL;
}
result = ns_response_to_wire(response, response_wire, response_size);
if (result != KNOT_EOK) {
knot_rrset_deep_free(&rrset, 1, 0);
knot_rrset_deep_free(&rrset, 1);
return KNOT_RCODE_SERVFAIL;
}
knot_rrset_deep_free(&rrset, 1, 0);
knot_rrset_deep_free(&rrset, 1);
knot_response_set_rcode(response, KNOT_RCODE_NOERROR);
return KNOT_RCODE_NOERROR;
......
......@@ -161,7 +161,7 @@ dbg_ns_exec_verb(
int ret = knot_packet_add_tmp_rrset(resp, synth_rrset);
if (ret != KNOT_EOK) {
dbg_ns("Failed to add sythetized RRSet to tmp list.\n");
knot_rrset_deep_free(&synth_rrset, 1, 1);
knot_rrset_deep_free(&synth_rrset, 1);
return ret;
}
*rrset = synth_rrset;
......@@ -348,7 +348,7 @@ static int ns_follow_cname(const knot_node_t **node,
dbg_ns("Failed to add synthetized RRSet (CNAME "
"follow) to the tmp RRSets in response."
"\n");
knot_rrset_deep_free(&rrset, 1, 1);
knot_rrset_deep_free(&rrset, 1);
cname_chain_free(&cname_chain);
return ret;
}
......@@ -888,7 +888,7 @@ static int ns_put_authority_soa(const knot_zone_contents_t *zone,
/* Need to add it as temporary, so it get's freed. */
ret = knot_packet_add_tmp_rrset(resp, soa_copy);
if (ret != KNOT_EOK) {
knot_rrset_deep_free(&soa_copy, 1, 1);
knot_rrset_deep_free(&soa_copy, 1);
return ret;
}
}
......
......@@ -167,7 +167,7 @@ dbg_packet_exec_verb(
if (size - *pos < rdlength) {
dbg_packet("Malformed RR: Not enough data to parse RR"
" RDATA (size: %zu, position: %zu).\n", size, *pos);
knot_rrset_deep_free(&rrset, 1, 1);
knot_rrset_deep_free(&rrset, 1);
return NULL;
}
......@@ -184,7 +184,7 @@ dbg_packet_exec_verb(
int ret = knot_packet_parse_rdata(rrset, wire, pos, size, rdlength);
if (ret != KNOT_EOK) {
dbg_packet("Malformed RR: Could not parse RDATA.\n");
knot_rrset_deep_free(&rrset, 1, 1);
knot_rrset_deep_free(&rrset, 1);
return NULL;
}
......@@ -300,10 +300,10 @@ static int knot_packet_parse_rrs(const uint8_t *wire, size_t *pos,
break;
} else if (err == 1) { // merged, shallow data copy
dbg_packet_detail("RRSet merged, freeing.\n");
knot_rrset_deep_free(&rrset, 1, 0);
knot_rrset_deep_free(&rrset, 1);
continue;
} else if (err == 2) { // skipped
knot_rrset_deep_free(&rrset, 1, 1);
knot_rrset_deep_free(&rrset, 1);
continue;
}
......@@ -312,7 +312,7 @@ static int knot_packet_parse_rrs(const uint8_t *wire, size_t *pos,
// remove the last RRSet from the list of RRSets
// - just decrement the count
--(*rrset_count);
knot_rrset_deep_free(&rrset, 1, 1);
knot_rrset_deep_free(&rrset, 1);
break;
}
......@@ -1024,7 +1024,7 @@ dbg_packet_exec(
// function (for reallocating rrset array)
// TODO sort out freeing, this WILL leak.
knot_rrset_deep_free(
&(((knot_rrset_t **)(pkt->tmp_rrsets))[i]), 1, 1);
&(((knot_rrset_t **)(pkt->tmp_rrsets))[i]), 1);
}
}
......@@ -1179,7 +1179,7 @@ void knot_packet_dump(const knot_packet_t *packet)
static int knot_packet_free_section(const knot_rrset_t **s, short count) {
/*! \todo The API is really incompatible here. */
for (short i = 0; i < count; ++i)
knot_rrset_deep_free((knot_rrset_t **)s + i, 1, 1);
knot_rrset_deep_free((knot_rrset_t **)s + i, 1);
return count;
}
......
......@@ -1314,7 +1314,7 @@ int knot_rrset_deep_copy(const knot_rrset_t *from, knot_rrset_t **to)
result = knot_rrset_deep_copy_no_sig(from->rrsigs,
&(*to)->rrsigs);
if (result != KNOT_EOK) {
knot_rrset_deep_free(to, 1, 0);
knot_rrset_deep_free(to, 1);
}
}
......@@ -1361,8 +1361,7 @@ void knot_rrset_free(knot_rrset_t **rrset)
*rrset = NULL;
}
void knot_rrset_deep_free(knot_rrset_t **rrset, int free_owner,
int free_rdata_dnames)
void knot_rrset_deep_free(knot_rrset_t **rrset, int free_owner)
{
/*! \bug The number of different frees in rrset is too damn high! */
if (rrset == NULL || *rrset == NULL) {
......@@ -1370,8 +1369,7 @@ void knot_rrset_deep_free(knot_rrset_t **rrset, int free_owner,
}
if ((*rrset)->rrsigs != NULL) {
knot_rrset_deep_free(&(*rrset)->rrsigs, free_owner,
0 /* revelation: unused */);
knot_rrset_deep_free(&(*rrset)->rrsigs, free_owner);
}
free((*rrset)->rdata);
......@@ -1385,8 +1383,7 @@ void knot_rrset_deep_free(knot_rrset_t **rrset, int free_owner,
*rrset = NULL;
}
void knot_rrset_deep_free_no_sig(knot_rrset_t **rrset, int free_owner,
int free_rdata_dnames)
void knot_rrset_deep_free_no_sig(knot_rrset_t **rrset, int free_owner)
{
if (rrset == NULL || *rrset == NULL) {
return;
......@@ -1546,7 +1543,7 @@ int knot_rrset_sort_rdata(knot_rrset_t *rrset)
int result = knot_rrset_merge_sort(sorted, rrset, NULL, NULL);
if (result != KNOT_EOK) {
knot_rrset_deep_free(&sorted, 1, 1);
knot_rrset_deep_free(&sorted, 1);
return result;
}
......@@ -1920,7 +1917,7 @@ int knot_rrset_remove_rr_using_rrset(knot_rrset_t *from,
/* RR was removed, can be added to 'return' RRSet. */
ret = knot_rrset_add_rr_from_rrset(return_rr, what, i);
if (ret != KNOT_EOK) {
knot_rrset_deep_free(&return_rr, 0, 0);
knot_rrset_deep_free(&return_rr, 0);
dbg_xfrin("xfr: Could not add RR (%s).\n",
knot_strerror(ret));
return ret;
......@@ -1933,7 +1930,7 @@ int knot_rrset_remove_rr_using_rrset(knot_rrset_t *from,
dbg_rrset("rrset: remove_using_rrset: "
"RRSet removal failed (%s).\n",
knot_strerror(ret));
knot_rrset_deep_free(&return_rr, 0, 0);
knot_rrset_deep_free(&return_rr, 0);
return ret;
}
}
......@@ -1947,7 +1944,7 @@ int knot_rrset_remove_rr_using_rrset_del(knot_rrset_t *from,
{
knot_rrset_t *rr_removed = NULL;
int ret = knot_rrset_remove_rr_using_rrset(from, what, &rr_removed, 0);
knot_rrset_deep_free(&rr_removed, 1, 1);
knot_rrset_deep_free(&rr_removed, 1);
return ret;
for (uint16_t i = 0; i < what->rdata_count; ++i) {
int ret = knot_rrset_remove_rr(from, what, i);
......
......@@ -330,11 +330,9 @@ void knot_rrset_free(knot_rrset_t **rrset);
* present in RDATA. Set to 0 otherwise. (See
* knot_rdata_deep_free().)
*/
void knot_rrset_deep_free(knot_rrset_t **rrset, int free_owner,
int free_rdata_dnames);
void knot_rrset_deep_free(knot_rrset_t **rrset, int free_owner);
void knot_rrset_deep_free_no_sig(knot_rrset_t **rrset, int free_owner,
int free_rdata_dnames);
void knot_rrset_deep_free_no_sig(knot_rrset_t **rrset, int free_owner);
int knot_rrset_to_wire(const knot_rrset_t *rrset, uint8_t *wire, size_t *size,
size_t max_size, uint16_t *rr_count, void *comp_data);
......
......@@ -513,7 +513,7 @@ dbg_rrset_exec_detail(
if (ret != KNOT_EOK) {
dbg_tsig("TSIG: could not create wire or sign wire: %s\n",
knot_strerror(ret));
knot_rrset_deep_free(&tmp_tsig, 1, 1);
knot_rrset_deep_free(&tmp_tsig, 1);
return ret;
}
......@@ -531,11 +531,11 @@ dbg_rrset_exec_detail(
if (ret != KNOT_EOK) {
dbg_tsig("TSIG: rrset_to_wire = %s\n", knot_strerror(ret));
*digest_len = 0;
knot_rrset_deep_free(&tmp_tsig, 1, 1);
knot_rrset_deep_free(&tmp_tsig, 1);
return ret;
}
knot_rrset_deep_free(&tmp_tsig, 1, 1);
knot_rrset_deep_free(&tmp_tsig, 1);
dbg_tsig("TSIG: written TSIG RR (wire len %zu)\n", tsig_wire_len);
*msg_len += tsig_wire_len;
......@@ -584,7 +584,7 @@ int knot_tsig_sign_next(uint8_t *msg, size_t *msg_len, size_t msg_max_len,
uint8_t *wire = malloc(wire_len);
if (!wire) {
ERR_ALLOC_FAILED;
knot_rrset_deep_free(&tmp_tsig, 1, 1);
knot_rrset_deep_free(&tmp_tsig, 1);
return KNOT_ENOMEM;
}
memset(wire, 0, wire_len);
......@@ -613,13 +613,13 @@ int knot_tsig_sign_next(uint8_t *msg, size_t *msg_len, size_t msg_max_len,
/* No matter how the function did, this data is no longer needed. */
free(wire);
if (ret != KNOT_EOK) {
knot_rrset_deep_free(&tmp_tsig, 1, 1);
knot_rrset_deep_free(&tmp_tsig, 1);
*digest_len = 0;
return ret;
}
if (digest_tmp_len > *digest_len) {
knot_rrset_deep_free(&tmp_tsig, 1, 1);
knot_rrset_deep_free(&tmp_tsig, 1);
*digest_len = 0;
return KNOT_ESPACE;
}
......@@ -642,18 +642,18 @@ int knot_tsig_sign_next(uint8_t *msg, size_t *msg_len, size_t msg_max_len,
&tsig_wire_size, msg_max_len - *msg_len,
&rr_count, NULL);
if (ret != KNOT_EOK) {
knot_rrset_deep_free(&tmp_tsig, 1, 1);
knot_rrset_deep_free(&tmp_tsig, 1);
*digest_len = 0;
return ret;
}
/* This should not happen, at least one rr has to be converted. */
if (rr_count == 0) {
knot_rrset_deep_free(&tmp_tsig, 1, 1);
knot_rrset_deep_free(&tmp_tsig, 1);
return KNOT_EINVAL;
}
knot_rrset_deep_free(&tmp_tsig, 1, 1);
knot_rrset_deep_free(&tmp_tsig, 1);
*msg_len += tsig_wire_size;
uint16_t arcount = knot_wire_get_arcount(msg);
......@@ -875,12 +875,12 @@ int knot_tsig_add(uint8_t *msg, size_t *msg_len, size_t msg_max_len,
&rr_count, NULL);
if (ret != KNOT_EOK) {
dbg_tsig("TSIG: rrset_to_wire = %s\n", knot_strerror(ret));
knot_rrset_deep_free(&tmp_tsig, 1, 1);
knot_rrset_deep_free(&tmp_tsig, 1);
return ret;
}
/* key_name already referenced in RRSet, no need to free separately. */
knot_rrset_deep_free(&tmp_tsig, 1, 1);
knot_rrset_deep_free(&tmp_tsig, 1);
*msg_len += tsig_wire_len;
......
......@@ -195,7 +195,7 @@ int knot_changeset_add_rr(knot_changeset_t *chgs, knot_rrset_t *rr,
return KNOT_ERROR;
}
knot_rrset_deep_free(&rr, 1, 0);
knot_rrset_deep_free(&rr, 1);
return KNOT_EOK;
} else {
return knot_changeset_add_rrset(chgs, rr, part);
......@@ -339,7 +339,7 @@ int knot_changeset_merge(knot_changeset_t *ch1, knot_changeset_t *ch2)
// Use soa_to and serial from the second changeset
// soa_to from the first changeset is redundant, delete it
knot_rrset_deep_free(&ch1->soa_to, 1, 1);
knot_rrset_deep_free(&ch1->soa_to, 1);
ch1->soa_to = ch2->soa_to;
ch1->serial_to = ch2->serial_to;
......@@ -355,14 +355,14 @@ static void knot_free_changeset(knot_changeset_t *changeset)
// Delete RRSets in lists, in case there are any left
knot_rr_ln_t *rr_node;
WALK_LIST(rr_node, changeset->add) {
knot_rrset_deep_free(&rr_node->rr, 1, 1);
knot_rrset_deep_free(&rr_node->rr, 1);
}
WALK_LIST(rr_node, changeset->remove) {
knot_rrset_deep_free(&rr_node->rr, 1, 1);
knot_rrset_deep_free(&rr_node->rr, 1);
}
knot_rrset_deep_free(&changeset->soa_from, 1, 1);
knot_rrset_deep_free(&changeset->soa_to, 1, 1);
knot_rrset_deep_free(&changeset->soa_from, 1);
knot_rrset_deep_free(&changeset->soa_to, 1);
// Delete binary data
free(changeset->data);
......@@ -386,7 +386,7 @@ void knot_changesets_free(knot_changesets_t **changesets)
// Free pool with RRs in sets / changes
mp_delete((*changesets)->mmc_rr.ctx);
knot_rrset_deep_free(&(*changesets)->first_soa, 1, 1);
knot_rrset_deep_free(&(*changesets)->first_soa, 1);
free((*changesets)->changes);
free(*changesets);
......
......@@ -538,17 +538,17 @@ void knot_ddns_prereqs_free(knot_ddns_prereq_t **prereq)
int i;
for (i = 0; i < (*prereq)->exist_count; ++i) {
knot_rrset_deep_free(&(*prereq)->exist[i], 1, 1);
knot_rrset_deep_free(&(*prereq)->exist[i], 1);
}
free((*prereq)->exist);
for (i = 0; i < (*prereq)->exist_full_count; ++i) {
knot_rrset_deep_free(&(*prereq)->exist_full[i], 1, 1);
knot_rrset_deep_free(&(*prereq)->exist_full[i], 1);
}
free((*prereq)->exist_full);
for (i = 0; i < (*prereq)->not_exist_count; ++i) {
knot_rrset_deep_free(&(*prereq)->not_exist[i], 1, 1);
knot_rrset_deep_free(&(*prereq)->not_exist[i], 1);
}
free((*prereq)->not_exist);
......@@ -770,7 +770,7 @@ static int knot_ddns_process_add_cname(knot_node_t *node,
if (from_chgset_count == 1) {
/* Just delete the RRSet. */
knot_rrset_deep_free(&(from_chgset[0]), 1, 1);
knot_rrset_deep_free(&(from_chgset[0]), 1);
/* Okay, &(from_chgset[0]) is basically equal to just
* from_chgset, but it's more clear this way that we are
* deleting the first RRSet in the array ;-)
......@@ -792,7 +792,7 @@ static int knot_ddns_process_add_cname(knot_node_t *node,
changeset, removed_copy, KNOT_CHANGESET_REMOVE);
if (ret != KNOT_EOK) {
knot_rrset_deep_free(&removed_copy,
1, 1);
1);
dbg_ddns("Failed to add removed CNAME "
"to changeset: %s\n",
knot_strerror(ret));
......@@ -896,7 +896,7 @@ static int knot_ddns_add_rr_new_normal(knot_node_t *node, knot_rrset_t *rr_copy,
int ret = knot_changes_add_rrset(changes, rr_copy, KNOT_CHANGES_NEW);
if (ret != KNOT_EOK) {
knot_rrset_deep_free(&rr_copy, 1, 1);
knot_rrset_deep_free(&rr_copy, 1);
dbg_ddns("Failed to store copy of the added RR: "
"%s\n", knot_strerror(ret));
return ret;
......@@ -947,7 +947,7 @@ static int knot_ddns_add_rr_merge_normal(knot_rrset_t *node_rrset_copy,
return ret;
}
knot_rrset_deep_free(rr_copy, 1, 0);
knot_rrset_deep_free(rr_copy, 1);
if (rdata_in_copy == deleted_rrs) {
......@@ -1022,8 +1022,8 @@ dbg_ddns_exec_detail(
if (ret < KNOT_EOK) {
dbg_ddns("Failed to merge UPDATE RR to node RRSet.\n");
knot_rrset_deep_free(rr_copy, 1, 1);
knot_rrset_deep_free(&node_rrset_copy, 1, 1);
knot_rrset_deep_free(rr_copy, 1);
knot_rrset_deep_free(&node_rrset_copy, 1);
return ret;
}
......@@ -1033,7 +1033,7 @@ dbg_ddns_exec_detail(
KNOT_CHANGES_NEW);
if (r != KNOT_EOK) {
dbg_ddns("Failed to store RRSet copy to 'changes'\n");
knot_rrset_deep_free(&node_rrset_copy, 1, 1);
knot_rrset_deep_free(&node_rrset_copy, 1);
return r;
}
}
......@@ -1085,13 +1085,13 @@ static int knot_ddns_add_rr_to_chgset(const knot_rrset_t *rr,
ret = knot_changeset_add_rrset(changeset, chgset_rr,
KNOT_CHANGESET_ADD);
if (ret != KNOT_EOK) {
knot_rrset_deep_free(&chgset_rr, 1, 1);
knot_rrset_deep_free(&chgset_rr, 1);
dbg_ddns("Failed to add RR to changeset: %s.\n",
knot_strerror(ret));
return ret;
}
} else {
knot_rrset_deep_free(&chgset_rr, 1, 1);
knot_rrset_deep_free(&chgset_rr, 1);
}
return KNOT_EOK;
......@@ -1304,7 +1304,7 @@ static int knot_ddns_process_rem_rr(const knot_rrset_t *rr,
*/
ret = knot_changes_add_rrset(changes, rr_remove, KNOT_CHANGES_OLD);
if (ret != KNOT_EOK) {
knot_rrset_deep_free(&rr_remove, 1, 1);
knot_rrset_deep_free(&rr_remove, 1);
dbg_ddns_detail("Failed to add data to changes.\n");
return ret;
}
......@@ -1371,7 +1371,7 @@ static int knot_ddns_process_rem_rr(const knot_rrset_t *rr,
if (from_chgset_count == 1) {
/* Just delete the RRSet. */
knot_rrset_deep_free(&(from_chgset[0]), 1, 1);
knot_rrset_deep_free(&(from_chgset[0]), 1);
/* Finish processing, no adding to changeset. */
free(from_chgset);
......@@ -1399,7 +1399,7 @@ static int knot_ddns_process_rem_rr(const knot_rrset_t *rr,
if (ret != KNOT_EOK) {
dbg_ddns("Failed to store the RRSet copy to changeset: %s.\n",
knot_strerror(ret));
knot_rrset_deep_free(&to_chgset, 1, 1);
knot_rrset_deep_free(&to_chgset, 1);
return ret;
}
......@@ -1521,7 +1521,7 @@ static int knot_ddns_process_rem_rrset(const knot_rrset_t *rrset,
dbg_ddns("Failed to copy the removed RRSet: %s.\n",
knot_strerror(ret));
for (int j = 0; j < i; ++j) {
knot_rrset_deep_free(&to_chgset[j], 1, 1);
knot_rrset_deep_free(&to_chgset[j], 1);
}
free(to_chgset);
free(removed);
......@@ -1554,7 +1554,7 @@ static int knot_ddns_process_rem_rrset(const knot_rrset_t *rrset,
dbg_ddns("Failed to remove possible redundant RRs from ADD "
"section: %s.\n", knot_strerror(ret));
for (int i = 0; i < removed_count; ++i) {
knot_rrset_deep_free(&to_chgset[i], 1, 1);
knot_rrset_deep_free(&to_chgset[i], 1);
}
free(from_chgset);
free(to_chgset);
......@@ -1586,7 +1586,7 @@ static int knot_ddns_process_rem_rrset(const knot_rrset_t *rrset,
/* The array is cleared, we may delete the redundant RRs. */
for (int i = 0; i < from_chgset_count; ++i) {
knot_rrset_deep_free(&from_chgset[i], 1, 1);
knot_rrset_deep_free(&from_chgset[i], 1);
}
free(from_chgset);
......@@ -1600,7 +1600,7 @@ static int knot_ddns_process_rem_rrset(const knot_rrset_t *rrset,
dbg_ddns("Failed to store the RRSet copy to changeset: "
"%s.\n", knot_strerror(ret));
for (int j = i; j < removed_count; ++j) {
knot_rrset_deep_free(&to_chgset[j], 1, 1);
knot_rrset_deep_free(&to_chgset[j], 1);
}
free(to_chgset);
return ret;
......
This diff is collapsed.
......@@ -642,7 +642,7 @@ void knot_node_free_rrsets(knot_node_t *node, int free_rdata_dnames)
knot_rrset_t **rrs = node->rrset_tree;
for (uint16_t i = 0; i < node->rrset_count; ++i) {
knot_rrset_deep_free(&(rrs[i]), 1, free_rdata_dnames);
knot_rrset_deep_free(&(rrs[i]), 1);
}
}
......
......@@ -165,7 +165,7 @@ static int knot_zone_diff_changeset_add_rrset(knot_changeset_t *changeset,
KNOT_CHANGESET_ADD);
if (ret != KNOT_EOK) {
/* We have to free the copy now! */
knot_rrset_deep_free(&rrset_copy, 1, 1);
knot_rrset_deep_free(&rrset_copy, 1);
dbg_zonediff("zone_diff: add_rrset: Could not add RRSet. "