From 7384fa923e1ba403454903133b33f559b735fe75 Mon Sep 17 00:00:00 2001 From: Zbigniew Jędrzejewski-Szmek Date: Thu, 2 Jan 2014 19:49:43 -0500 Subject: networkd: do not deference null pointer in cleanup --- src/network/networkd-network.c | 5 ++++- 1 file changed, 4 insertions(+), 1 deletion(-) (limited to 'src/network') 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); } -- cgit v1.2.3-54-g00ecf