summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--src/libsystemd-network/sd-dhcp-client.c2
-rw-r--r--src/libsystemd-network/sd-dhcp6-client.c2
-rw-r--r--src/libsystemd-network/test-dhcp-client.c1
-rw-r--r--src/network/networkd-dhcp4.c4
4 files changed, 4 insertions, 5 deletions
diff --git a/src/libsystemd-network/sd-dhcp-client.c b/src/libsystemd-network/sd-dhcp-client.c
index 6a0d270739..46104afded 100644
--- a/src/libsystemd-network/sd-dhcp-client.c
+++ b/src/libsystemd-network/sd-dhcp-client.c
@@ -348,7 +348,7 @@ int sd_dhcp_client_get_lease(sd_dhcp_client *client, sd_dhcp_lease **ret) {
client->state != DHCP_STATE_REBINDING)
return -EADDRNOTAVAIL;
- *ret = sd_dhcp_lease_ref(client->lease);
+ *ret = client->lease;
return 0;
}
diff --git a/src/libsystemd-network/sd-dhcp6-client.c b/src/libsystemd-network/sd-dhcp6-client.c
index bc17c6adc5..10c3654020 100644
--- a/src/libsystemd-network/sd-dhcp6-client.c
+++ b/src/libsystemd-network/sd-dhcp6-client.c
@@ -260,7 +260,7 @@ int sd_dhcp6_client_get_lease(sd_dhcp6_client *client, sd_dhcp6_lease **ret) {
if (!client->lease)
return -ENOMSG;
- *ret = sd_dhcp6_lease_ref(client->lease);
+ *ret = client->lease;
return 0;
}
diff --git a/src/libsystemd-network/test-dhcp-client.c b/src/libsystemd-network/test-dhcp-client.c
index d341210887..200499d613 100644
--- a/src/libsystemd-network/test-dhcp-client.c
+++ b/src/libsystemd-network/test-dhcp-client.c
@@ -393,7 +393,6 @@ static void test_addr_acq_acquired(sd_dhcp_client *client, int event,
if (verbose)
printf(" DHCP address acquired\n");
- sd_dhcp_lease_unref(lease);
sd_event_exit(e, 0);
}
diff --git a/src/network/networkd-dhcp4.c b/src/network/networkd-dhcp4.c
index 6288644a1a..1b2ff7c769 100644
--- a/src/network/networkd-dhcp4.c
+++ b/src/network/networkd-dhcp4.c
@@ -365,7 +365,7 @@ static int dhcp_lease_renew(sd_dhcp_client *client, Link *link) {
sd_dhcp_lease_unref(link->dhcp_lease);
link->dhcp4_configured = false;
- link->dhcp_lease = lease;
+ link->dhcp_lease = sd_dhcp_lease_ref(lease);
r = sd_dhcp_lease_get_address(lease, &address);
if (r < 0) {
@@ -454,7 +454,7 @@ static int dhcp_lease_acquired(sd_dhcp_client *client, Link *link) {
"PREFIXLEN=%u", prefixlen,
NULL);
- link->dhcp_lease = lease;
+ link->dhcp_lease = sd_dhcp_lease_ref(lease);
if (link->network->dhcp_mtu) {
uint16_t mtu;