summaryrefslogtreecommitdiff
path: root/src/network/networkd-dhcp4.c
diff options
context:
space:
mode:
authorZbigniew Jędrzejewski-Szmek <zbyszek@in.waw.pl>2019-10-02 10:29:41 +0200
committerZbigniew Jędrzejewski-Szmek <zbyszek@in.waw.pl>2019-10-02 14:01:42 +0200
commit8bea7e700f5e73d9a92583f71647c9788defb843 (patch)
treeeabc68df18f9e59955c6acd9f53697c8558f9863 /src/network/networkd-dhcp4.c
parent8ff4585ffa870bce1a02dbf53cfcae7f559c3e83 (diff)
downloadsystemd-8bea7e700f5e73d9a92583f71647c9788defb843.tar.gz
systemd-8bea7e700f5e73d9a92583f71647c9788defb843.tar.bz2
systemd-8bea7e700f5e73d9a92583f71647c9788defb843.zip
sd-dhcp-client: do not crash if sd_dhcp_client_send_release() is called with no lease
Again, a public function should not crash if called at an inopportune moment. Also, make sure we don't call the function if we have no lease.
Diffstat (limited to 'src/network/networkd-dhcp4.c')
-rw-r--r--src/network/networkd-dhcp4.c6
1 files changed, 3 insertions, 3 deletions
diff --git a/src/network/networkd-dhcp4.c b/src/network/networkd-dhcp4.c
index 78cd241140..db762163a8 100644
--- a/src/network/networkd-dhcp4.c
+++ b/src/network/networkd-dhcp4.c
@@ -864,10 +864,10 @@ static int dhcp4_handler(sd_dhcp_client *client, int event, void *userdata) {
return 0;
}
- if (link->network->dhcp_send_release)
- (void) sd_dhcp_client_send_release(client);
-
if (link->dhcp_lease) {
+ if (link->network->dhcp_send_release)
+ (void) sd_dhcp_client_send_release(client);
+
r = dhcp_lease_lost(link);
if (r < 0) {
link_enter_failed(link);