summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorSusant Sahani <susant@redhat.com>2017-02-22 10:55:03 +0530
committerSusant Sahani <susant@redhat.com>2017-02-22 10:55:03 +0530
commitfcc48287eb6166b87a80da87d383d013f6dec7e1 (patch)
tree3cb51889e988454a90807af6bcbf25ccbf857072
parentb965427b59a6912a46e1cdb26b732d3ea396b332 (diff)
networkd: Do not set config to NULL immediately.
fd45e52 sets n to NULL which leads to crash. fixes: #5418
-rw-r--r--src/network/networkd-address.c5
-rw-r--r--src/network/networkd-route.c2
2 files changed, 4 insertions, 3 deletions
diff --git a/src/network/networkd-address.c b/src/network/networkd-address.c
index 9d0311d76f..e872b36009 100644
--- a/src/network/networkd-address.c
+++ b/src/network/networkd-address.c
@@ -85,7 +85,9 @@ 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;
+
+ hashmap_put(network->addresses_by_section, address->section, address);
}
address->network = network;
@@ -94,7 +96,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;
}