]> git.ipfire.org Git - thirdparty/systemd.git/commitdiff
network: use the same hash ops used when allocated
authorYu Watanabe <watanabe.yu+github@gmail.com>
Fri, 13 Jun 2025 14:46:26 +0000 (23:46 +0900)
committerYu Watanabe <watanabe.yu+github@gmail.com>
Fri, 13 Jun 2025 14:46:29 +0000 (23:46 +0900)
Fixes #37830.

src/network/networkd-link-bus.c

index bd477a2d1c57c32e5ea1ec7532fe94c8f7d9bb80..297e1461bd4695398e0ea27a7e2c561fa018d62d 100644 (file)
@@ -506,12 +506,14 @@ 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);
         }
 
+        /* The method accepts an empty strv, to override the negative trust anchors set in .network.
+         * Hence, we need to explicitly allocate an empty set here. */
         ns = set_new(&dns_name_hash_ops_free);
         if (!ns)
                 return -ENOMEM;
 
         STRV_FOREACH(i, ntas) {
-                r = set_put_strdup(&ns, *i);
+                r = set_put_strdup_full(&ns, &dns_name_hash_ops_free, *i);
                 if (r < 0)
                         return r;
         }