network: use dns_name_hash_ops_free in dnssec negative trust anchors

This commit is contained in:
Yu Watanabe
2025-04-13 10:09:45 +09:00
parent e2603934d5
commit 25a9bd72ef
4 changed files with 7 additions and 8 deletions
+2 -2
View File
@@ -281,7 +281,7 @@ int config_parse_dnssec_negative_trust_anchors(
assert(rvalue);
if (isempty(rvalue)) {
*nta = set_free_free(*nta);
*nta = set_free(*nta);
return 0;
}
@@ -306,7 +306,7 @@ int config_parse_dnssec_negative_trust_anchors(
continue;
}
r = set_ensure_consume(nta, &dns_name_hash_ops, TAKE_PTR(w));
r = set_ensure_consume(nta, &dns_name_hash_ops_free, TAKE_PTR(w));
if (r < 0)
return log_oom();
}
+3 -4
View File
@@ -479,7 +479,7 @@ int bus_link_method_set_dnssec(sd_bus_message *message, void *userdata, sd_bus_e
}
int bus_link_method_set_dnssec_negative_trust_anchors(sd_bus_message *message, void *userdata, sd_bus_error *error) {
_cleanup_set_free_free_ Set *ns = NULL;
_cleanup_set_free_ Set *ns = NULL;
_cleanup_strv_free_ char **ntas = NULL;
Link *l = ASSERT_PTR(userdata);
int r;
@@ -502,7 +502,7 @@ int bus_link_method_set_dnssec_negative_trust_anchors(sd_bus_message *message, v
return sd_bus_error_setf(error, SD_BUS_ERROR_INVALID_ARGS, "Invalid negative trust anchor domain: %s", *i);
}
ns = set_new(&dns_name_hash_ops);
ns = set_new(&dns_name_hash_ops_free);
if (!ns)
return -ENOMEM;
@@ -523,8 +523,7 @@ int bus_link_method_set_dnssec_negative_trust_anchors(sd_bus_message *message, v
if (r == 0)
return 1; /* Polkit will call us back */
set_free_free(l->dnssec_negative_trust_anchors);
l->dnssec_negative_trust_anchors = TAKE_PTR(ns);
set_free_and_replace(l->dnssec_negative_trust_anchors, ns);
r = link_save_and_clean_full(l, /* also_save_manager = */ true);
if (r < 0)
+1 -1
View File
@@ -231,7 +231,7 @@ void link_dns_settings_clear(Link *link) {
link->dnssec_mode = _DNSSEC_MODE_INVALID;
link->dns_over_tls_mode = _DNS_OVER_TLS_MODE_INVALID;
link->dnssec_negative_trust_anchors = set_free_free(link->dnssec_negative_trust_anchors);
link->dnssec_negative_trust_anchors = set_free(link->dnssec_negative_trust_anchors);
}
static void link_free_engines(Link *link) {
+1 -1
View File
@@ -752,7 +752,7 @@ static Network *network_free(Network *network) {
free(network->dns);
ordered_set_free(network->search_domains);
ordered_set_free(network->route_domains);
set_free_free(network->dnssec_negative_trust_anchors);
set_free(network->dnssec_negative_trust_anchors);
/* DHCP server */
free(network->dhcp_server_relay_agent_circuit_id);