if (!set_isempty(d->negative_by_name))
return 0;
- r = set_ensure_allocated(&d->negative_by_name, &dns_name_hash_ops);
- if (r < 0)
- return r;
-
/* We add a couple of domains as default negative trust
* anchors, where it's very unlikely they will be installed in
* the root zone. If they exist they must be private, and thus
if (dns_trust_anchor_knows_domain_positive(d, name))
continue;
- r = set_put_strdup(&d->negative_by_name, name);
+ r = set_put_strdup_full(&d->negative_by_name, &dns_name_hash_ops_free, name);
if (r < 0)
return r;
}
d->positive_by_key = hashmap_free_with_destructor(d->positive_by_key, dns_answer_unref);
d->revoked_by_rr = set_free_with_destructor(d->revoked_by_rr, dns_resource_record_unref);
- d->negative_by_name = set_free_free(d->negative_by_name);
+ d->negative_by_name = set_free(d->negative_by_name);
}
int dns_trust_anchor_lookup_positive(DnsTrustAnchor *d, const DnsResourceKey *key, DnsAnswer **ret) {
}
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;
_cleanup_free_ char *j = NULL;
Link *l = ASSERT_PTR(userdata);
if (r < 0)
return r;
- ns = set_new(&dns_name_hash_ops);
+ ns = set_new(&dns_name_hash_ops_free);
if (!ns)
return -ENOMEM;
bus_client_log(message, "DNSSEC NTA change");
if (!set_equal(ns, l->dnssec_negative_trust_anchors)) {
- 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);
(void) link_save_user(l);
dns_server_unlink_all(l->dns_servers);
dns_search_domain_unlink_all(l->search_domains);
- l->dnssec_negative_trust_anchors = set_free_free(l->dnssec_negative_trust_anchors);
+ l->dnssec_negative_trust_anchors = set_free(l->dnssec_negative_trust_anchors);
}
Link *link_free(Link *l) {
static int link_update_dnssec_negative_trust_anchors(Link *l) {
_cleanup_strv_free_ char **ntas = NULL;
- _cleanup_set_free_free_ Set *ns = NULL;
+ _cleanup_set_free_ Set *ns = NULL;
int r;
assert(l);
- l->dnssec_negative_trust_anchors = set_free_free(l->dnssec_negative_trust_anchors);
+ l->dnssec_negative_trust_anchors = set_free(l->dnssec_negative_trust_anchors);
r = sd_network_link_get_dnssec_negative_trust_anchors(l->ifindex, &ntas);
if (r == -ENODATA)
if (r < 0)
return r;
- ns = set_new(&dns_name_hash_ops);
+ ns = set_new(&dns_name_hash_ops_free);
if (!ns)
return -ENOMEM;
}
if (ntas) {
- _cleanup_set_free_free_ Set *ns = NULL;
+ _cleanup_set_free_ Set *ns = NULL;
- ns = set_new(&dns_name_hash_ops);
+ ns = set_new(&dns_name_hash_ops_free);
if (!ns) {
r = -ENOMEM;
goto fail;