diff --git a/dhcpd/v4.go b/dhcpd/v4.go index b283079a..997b69f8 100644 --- a/dhcpd/v4.go +++ b/dhcpd/v4.go @@ -146,6 +146,9 @@ func (s *v4Server) rmDynamicLease(lease Lease) error { } s.leaseRemoveSwapByIndex(i) + if i == len(s.leases) { + break + } l = s.leases[i] } diff --git a/dhcpd/v6.go b/dhcpd/v6.go index 8f042e25..5259777a 100644 --- a/dhcpd/v6.go +++ b/dhcpd/v6.go @@ -134,6 +134,9 @@ func (s *v6Server) rmDynamicLease(lease Lease) error { } s.leaseRemoveSwapByIndex(i) + if i == len(s.leases) { + break + } l = s.leases[i] }