summaryrefslogtreecommitdiff
path: root/src
diff options
context:
space:
mode:
authorTom Gundersen <teg@jklm.no>2014-03-31 10:01:59 +0200
committerTom Gundersen <teg@jklm.no>2014-03-31 10:01:59 +0200
commit2292547af9638e2b3f7e0e96a56dd6c909e516dc (patch)
tree650660bf8bbf442214fc05f8f8109ede562fc942 /src
parentc8a7165f582c322628a9b07fc7e01d0aab184b48 (diff)
networkd: fix use-after-free
Free networks before links (the reverse of creation order).
Diffstat (limited to 'src')
-rw-r--r--src/network/networkd-manager.c6
1 files changed, 3 insertions, 3 deletions
diff --git a/src/network/networkd-manager.c b/src/network/networkd-manager.c
index b2cb0fab4d..ddbdabbff9 100644
--- a/src/network/networkd-manager.c
+++ b/src/network/networkd-manager.c
@@ -145,13 +145,13 @@ void manager_free(Manager *m) {
sd_event_source_unref(m->sigint_event_source);
sd_event_unref(m->event);
- while ((network = m->networks))
- network_free(network);
-
while ((link = hashmap_first(m->links)))
link_free(link);
hashmap_free(m->links);
+ while ((network = m->networks))
+ network_free(network);
+
while ((netdev = hashmap_first(m->netdevs)))
netdev_free(netdev);
hashmap_free(m->netdevs);