summaryrefslogtreecommitdiff
path: root/src
diff options
context:
space:
mode:
authorTom Gundersen <teg@jklm.no>2014-08-19 15:41:23 +0200
committerTom Gundersen <teg@jklm.no>2014-08-19 15:41:23 +0200
commit2c36be2f4ba38f9097cdcdcd1e724ffa46da12c7 (patch)
tree25ba47b3eee02fcd9c93334e14f3616eca506c59 /src
parent93aef81600437b96c96c6ca32ce85df32631c351 (diff)
networkd: fix use-after-free
Elements must be removed from the hashtable before they are freed.
Diffstat (limited to 'src')
-rw-r--r--src/network/networkd-network.c4
1 files changed, 3 insertions, 1 deletions
diff --git a/src/network/networkd-network.c b/src/network/networkd-network.c
index 803fcdd609..fc62395217 100644
--- a/src/network/networkd-network.c
+++ b/src/network/networkd-network.c
@@ -172,8 +172,10 @@ void network_free(Network *network) {
netdev_unref(network->bond);
- HASHMAP_FOREACH(netdev, network->stacked_netdevs, i)
+ HASHMAP_FOREACH(netdev, network->stacked_netdevs, i) {
+ hashmap_remove(network->stacked_netdevs, netdev->ifname);
netdev_unref(netdev);
+ }
hashmap_free(network->stacked_netdevs);
while ((route = network->static_routes))