From 25a9bd72ef05e1ccb14ad9c974585df01251153a Mon Sep 17 00:00:00 2001 From: Yu Watanabe Date: Fri, 11 Apr 2025 10:56:12 +0900 Subject: [PATCH] network: use dns_name_hash_ops_free in dnssec negative trust anchors --- src/network/networkd-dns.c | 4 ++-- src/network/networkd-link-bus.c | 7 +++---- src/network/networkd-link.c | 2 +- src/network/networkd-network.c | 2 +- 4 files changed, 7 insertions(+), 8 deletions(-) diff --git a/src/network/networkd-dns.c b/src/network/networkd-dns.c index a8164912dc1..bc3bc65c200 100644 --- a/src/network/networkd-dns.c +++ b/src/network/networkd-dns.c @@ -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(); } diff --git a/src/network/networkd-link-bus.c b/src/network/networkd-link-bus.c index 27ee855181e..dfecd76d226 100644 --- a/src/network/networkd-link-bus.c +++ b/src/network/networkd-link-bus.c @@ -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) diff --git a/src/network/networkd-link.c b/src/network/networkd-link.c index 8a8c41eaacd..fdb9e52a811 100644 --- a/src/network/networkd-link.c +++ b/src/network/networkd-link.c @@ -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) { diff --git a/src/network/networkd-network.c b/src/network/networkd-network.c index 00851243b5a..db36893d957 100644 --- a/src/network/networkd-network.c +++ b/src/network/networkd-network.c @@ -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); -- 2.47.3