diff options
author | Hristo Venev <hristo@venev.name> | 2015-10-29 12:14:44 +0200 |
---|---|---|
committer | Hristo Venev <hristo@venev.name> | 2015-10-29 12:18:02 +0200 |
commit | 4701725cd58bc75a287ba050c8ad69a457b68d5d (patch) | |
tree | 191461f69227e09863defd1ff77877885632026b | |
parent | 2c80779e33e2bea8e335f3c93b144f671d6bc62c (diff) |
network: fix use-after-free in link_free
Freeing a link removes it both from addresses and addresses_foreign,
causing SIGSEGV if one of the sets is freed.
-rw-r--r-- | src/network/networkd-link.c | 6 |
1 files changed, 3 insertions, 3 deletions
diff --git a/src/network/networkd-link.c b/src/network/networkd-link.c index dcc2569660..12ca02868d 100644 --- a/src/network/networkd-link.c +++ b/src/network/networkd-link.c @@ -349,12 +349,12 @@ static void link_free(Link *link) { while (!set_isempty(link->addresses)) address_free(set_first(link->addresses)); - set_free(link->addresses); - while (!set_isempty(link->addresses_foreign)) address_free(set_first(link->addresses_foreign)); - set_free(link->addresses_foreign); + link->addresses = set_free(link->addresses); + + link->addresses_foreign = set_free(link->addresses_foreign); while ((address = link->pool_addresses)) { LIST_REMOVE(addresses, link->pool_addresses, address); |