summaryrefslogtreecommitdiff
path: root/src/network/networkd-network.c
diff options
context:
space:
mode:
Diffstat (limited to 'src/network/networkd-network.c')
-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);
}