From: Susant Sahani Date: Thu, 14 Jan 2021 05:25:12 +0000 (+0100) Subject: network: wireguard - Use hashmap_ensure_put X-Git-Tag: v248-rc1~323^2~14 X-Git-Url: http://git.ipfire.org/?a=commitdiff_plain;h=b77071b8989bd7859804087711fa37ca23b0027b;p=thirdparty%2Fsystemd.git network: wireguard - Use hashmap_ensure_put --- diff --git a/src/network/netdev/wireguard.c b/src/network/netdev/wireguard.c index 76444bdd7ce..e442ecc266a 100644 --- a/src/network/netdev/wireguard.c +++ b/src/network/netdev/wireguard.c @@ -91,11 +91,7 @@ static int wireguard_peer_new_static(Wireguard *w, const char *filename, unsigne LIST_PREPEND(peers, w->peers, peer); - r = hashmap_ensure_allocated(&w->peers_by_section, &network_config_hash_ops); - if (r < 0) - return r; - - r = hashmap_put(w->peers_by_section, peer->section, peer); + r = hashmap_ensure_put(&w->peers_by_section, &network_config_hash_ops, peer->section, peer); if (r < 0) return r;