diff options
author | Zbigniew Jędrzejewski-Szmek <zbyszek@in.waw.pl> | 2017-02-22 11:56:16 -0500 |
---|---|---|
committer | GitHub <noreply@github.com> | 2017-02-22 11:56:16 -0500 |
commit | be02637a3c0d24c21a9851e2b091938ff65eb595 (patch) | |
tree | 4c9dbd64dbe4f942954211c4a93626408434730e | |
parent | Makefile.am: add a `\` (#5422) (diff) | |
parent | networkd: address config add error checking (diff) | |
download | systemd-be02637a3c0d24c21a9851e2b091938ff65eb595.tar.gz systemd-be02637a3c0d24c21a9851e2b091938ff65eb595.tar.bz2 systemd-be02637a3c0d24c21a9851e2b091938ff65eb595.zip |
Merge pull request #5421 from ssahani/net7
networkd: Do not set config to NULL immediately.
-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 9d0311d76..e34793e50 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 a8ba293ae..570083f18 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; } |