networkd: Do not set config to NULL immediately.

fd45e52 sets
n to NULL which leads to crash.

fixes: #5418
This commit is contained in:
Susant Sahani
2017-02-22 10:55:03 +05:30
parent b965427b59
commit fcc48287eb
2 changed files with 4 additions and 3 deletions
+3 -2
View File
@@ -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;
}
+1 -1
View File
@@ -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;
}