From c75165cade8dc306ae84145c200d37622600a67f Mon Sep 17 00:00:00 2001 From: Susant Sahani Date: Thu, 14 Jan 2021 06:30:39 +0100 Subject: [PATCH] network: dhcp6 - use hashmap_ensure_put --- src/network/networkd-dhcp6.c | 6 ++---- 1 file changed, 2 insertions(+), 4 deletions(-) diff --git a/src/network/networkd-dhcp6.c b/src/network/networkd-dhcp6.c index 9571221da29..d9b45a8a145 100644 --- a/src/network/networkd-dhcp6.c +++ b/src/network/networkd-dhcp6.c @@ -309,11 +309,9 @@ static int dhcp6_set_pd_route(Link *link, const union in_addr_union *prefix, con .link = link_ref(link), }; - r = hashmap_ensure_allocated(&link->manager->dhcp6_prefixes, &in6_addr_hash_ops); - if (r < 0) + r = hashmap_ensure_put(&link->manager->dhcp6_prefixes, &in6_addr_hash_ops, &pd->prefix, pd); + if (r == -ENOMEM) return log_oom(); - - r = hashmap_put(link->manager->dhcp6_prefixes, &pd->prefix, pd); if (r < 0) return log_link_error_errno(link, r, "Failed to store DHCPv6 prefix route at manager: %m");