diff options
author | Tom Gundersen <teg@jklm.no> | 2014-01-03 00:55:35 +0100 |
---|---|---|
committer | Tom Gundersen <teg@jklm.no> | 2014-01-03 01:42:26 +0100 |
commit | b1b532f58c99f8d199e6081fa9f23b99f8af2a84 (patch) | |
tree | d1559f3225319a34f7c86d869f853dd792245846 /src/network/networkd-link.c | |
parent | 1746cf2ad70d95c36064686d4f9b07a80e3bae99 (diff) |
networkd: dhcp - avoid null pointer dereference
Diffstat (limited to 'src/network/networkd-link.c')
-rw-r--r-- | src/network/networkd-link.c | 14 |
1 files changed, 9 insertions, 5 deletions
diff --git a/src/network/networkd-link.c b/src/network/networkd-link.c index 87f32f00a6..17a1e49881 100644 --- a/src/network/networkd-link.c +++ b/src/network/networkd-link.c @@ -513,13 +513,17 @@ static void dhcp_handler(sd_dhcp_client *client, int event, void *userdata) { if (event == DHCP_EVENT_IP_CHANGE || event == DHCP_EVENT_EXPIRED || event == DHCP_EVENT_STOP) { - address_drop(link->dhcp_address, link, address_drop_handler); + if (link->dhcp_address) { + address_drop(link->dhcp_address, link, address_drop_handler); - address_free(link->dhcp_address); - link->dhcp_address = NULL; + address_free(link->dhcp_address); + link->dhcp_address = NULL; + } - route_free(link->dhcp_route); - link->dhcp_route = NULL; + if (link->dhcp_route) { + route_free(link->dhcp_route); + link->dhcp_route = NULL; + } } r = sd_dhcp_client_get_address(client, &address); |