chiark / gitweb /
networkd: do not deference null pointer in cleanup
authorZbigniew Jędrzejewski-Szmek <zbyszek@in.waw.pl>
Fri, 3 Jan 2014 00:49:43 +0000 (19:49 -0500)
committerZbigniew Jędrzejewski-Szmek <zbyszek@in.waw.pl>
Fri, 3 Jan 2014 00:49:43 +0000 (19:49 -0500)
src/network/networkd-network.c

index e0e3878..9533aff 100644 (file)
@@ -109,6 +109,8 @@ void network_free(Network *network) {
         if (!network)
                 return;
 
+        assert(network->manager);
+
         free(network->filename);
 
         free(network->match_mac);
@@ -128,7 +130,8 @@ void network_free(Network *network) {
         hashmap_free(network->addresses_by_section);
         hashmap_free(network->routes_by_section);
 
-        LIST_REMOVE(networks, network->manager->networks, network);
+        if (network->manager->networks)
+                LIST_REMOVE(networks, network->manager->networks, network);
 
         free(network);
 }