dhcpv6-ia: fix crash in dhcpv6_free_lease()
authorDavid Härdeman <[email protected]>
Mon, 1 Dec 2025 07:37:32 +0000 (08:37 +0100)
committerÁlvaro Fernández Rojas <[email protected]>
Mon, 1 Dec 2025 08:06:32 +0000 (09:06 +0100)
Note that dhcpv6_free_lease() can be called with a NULL argument e.g.
from dhcpv6_ia_handle_IAs() when iface->no_dynamic_dhcp is set and a
client without a static lease cfg tries to get a dynamic lease.

Closes: #321
Signed-off-by: David Härdeman <[email protected]>
Link: https://github.com/openwrt/odhcpd/pull/335
Signed-off-by: Álvaro Fernández Rojas <[email protected]>
src/dhcpv6-ia.c

index f227ad60c731f46e22032d53547bdbe1e22191e5..5af952d1bcfad770fe1e597ac84183d7559a3ed8 100644 (file)
@@ -60,6 +60,9 @@ dhcpv6_alloc_lease(size_t extra_len)
 
 void dhcpv6_free_lease(struct dhcpv6_lease *a)
 {
+       if (!a)
+               return;
+
        list_del(&a->head);
        list_del(&a->lease_cfg_list);