summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorZbigniew Jędrzejewski-Szmek <zbyszek@in.waw.pl>2014-01-02 19:49:43 -0500
committerZbigniew Jędrzejewski-Szmek <zbyszek@in.waw.pl>2014-01-02 19:49:43 -0500
commit7384fa923e1ba403454903133b33f559b735fe75 (patch)
tree0b2c5942d9d7f580cd783e0a4ddaeab30075df49
parentd4c636603a2c7594faa66f9c3e6c75f5ccb5c3e4 (diff)
networkd: do not deference null pointer in cleanup
-rw-r--r--src/network/networkd-network.c5
1 files changed, 4 insertions, 1 deletions
diff --git a/src/network/networkd-network.c b/src/network/networkd-network.c
index e0e3878f75..9533aff8e3 100644
--- a/src/network/networkd-network.c
+++ b/src/network/networkd-network.c
@@ -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);
}