diff options
-rw-r--r-- | src/network/networkd-address.c | 7 | ||||
-rw-r--r-- | src/network/networkd-route.c | 2 |
2 files changed, 6 insertions, 3 deletions
diff --git a/src/network/networkd-address.c b/src/network/networkd-address.c index 9d0311d76f..e34793e50b 100644 --- a/src/network/networkd-address.c +++ b/src/network/networkd-address.c @@ -85,7 +85,11 @@ int address_new_static(Network *network, const char *filename, unsigned section_ if (filename) { address->section = n; - hashmap_put(network->addresses_by_section, n, address); + n = NULL; + + r = hashmap_put(network->addresses_by_section, address->section, address); + if (r < 0) + return r; } address->network = network; @@ -94,7 +98,6 @@ int address_new_static(Network *network, const char *filename, unsigned section_ *ret = address; address = NULL; - n = NULL; return 0; } diff --git a/src/network/networkd-route.c b/src/network/networkd-route.c index a8ba293ae8..570083f180 100644 --- a/src/network/networkd-route.c +++ b/src/network/networkd-route.c @@ -113,7 +113,7 @@ int route_new_static(Network *network, const char *filename, unsigned section_li route->section = n; n = NULL; - r = hashmap_put(network->routes_by_section, n, route); + r = hashmap_put(network->routes_by_section, route->section, route); if (r < 0) return r; } |