]> git.ipfire.org Git - thirdparty/systemd.git/commitdiff
networkd: Do not set config to NULL immediately.
authorSusant Sahani <susant@redhat.com>
Wed, 22 Feb 2017 05:25:03 +0000 (10:55 +0530)
committerSusant Sahani <susant@redhat.com>
Wed, 22 Feb 2017 05:25:03 +0000 (10:55 +0530)
fd45e52 sets
n to NULL which leads to crash.

fixes: #5418

src/network/networkd-address.c
src/network/networkd-route.c

index 9d0311d76f9fdcaffe8837179a644178e768ce4d..e872b36009edffa01b47009c8e20c0a1d5242787 100644 (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;
 }
index a8ba293ae8ab88ec1ea9ad713bc1421053622ae6..570083f1803b626a017ef900c2bdaf709eab21f5 100644 (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;
         }