Skip to contentSkip to conversation

dhcp: Reset lease on client stop

PATCH Applied Tim Kourt 2 participants 2 messages Jun 20, 2019

lore
Share & tools
lore

Tim Kourt

author
#0 lore raw

PATCH 1/1 dhcp: Reset lease on client stop

The un-reset lease variable used to be freed multiple times when the client is explicitly stopped before being destroyed.

==12374== Invalid read of size 8

==12374==    at 0x46C889: _dhcp_lease_free (dhcp-lease.c:47)
==12374==    by 0x46B5F2: l_dhcp_client_stop (dhcp.c:1220)
==12374==    by 0x46B61D: l_dhcp_client_destroy (dhcp.c:1011)
---
 ell/dhcp.c | 2 ++
 1 file changed, 2 insertions(+)
ell/dhcp.c +2 -0
index f57f13b..57d5ae2 100644
@@ -1218,6 +1218,8 @@ LIB_EXPORT bool l_dhcp_client_stop(struct l_dhcp_client *client)
 	CLIENT_ENTER_STATE(DHCP_STATE_INIT);
 
 	_dhcp_lease_free(client->lease);
+	client->lease = NULL;
+
 	return true;
 }
 
Signature · 1 line
2.13.6
#1 lore raw

Hi Tim,

Quoted 11 lines · Tim Kourt

The un-reset lease variable used to be freed multiple times when the client is explicitly stopped before being destroyed.

==12374== Invalid read of size 8

==12374==    at 0x46C889: _dhcp_lease_free (dhcp-lease.c:47)
==12374==    by 0x46B5F2: l_dhcp_client_stop (dhcp.c:1220)
==12374==    by 0x46B61D: l_dhcp_client_destroy (dhcp.c:1011)
---
  ell/dhcp.c | 2 ++
  1 file changed, 2 insertions(+)

Applied, thanks.

Regards,
-Denis