summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorZbigniew Jędrzejewski-Szmek <zbyszek@in.waw.pl>2017-02-22 11:56:16 -0500
committerGitHub <noreply@github.com>2017-02-22 11:56:16 -0500
commitbe02637a3c0d24c21a9851e2b091938ff65eb595 (patch)
tree4c9dbd64dbe4f942954211c4a93626408434730e
parent00d1e0c9def4557c74f46cc2fe3a7ebc32a1dc8a (diff)
parentf7fe70ea310d159754750fc3acac0e3f6aae67be (diff)
Merge pull request #5421 from ssahani/net7
networkd: Do not set config to NULL immediately.
-rw-r--r--src/network/networkd-address.c7
-rw-r--r--src/network/networkd-route.c2
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;
}