summaryrefslogtreecommitdiff
path: root/networking/udhcp/leases.c
diff options
context:
space:
mode:
Diffstat (limited to 'networking/udhcp/leases.c')
-rw-r--r--networking/udhcp/leases.c4
1 files changed, 3 insertions, 1 deletions
diff --git a/networking/udhcp/leases.c b/networking/udhcp/leases.c
index 844bb60..411b749 100644
--- a/networking/udhcp/leases.c
+++ b/networking/udhcp/leases.c
@@ -17,7 +17,9 @@ static struct dyn_lease *oldest_expired_lease(void)
/* Unexpired leases have g_leases[i].expires >= current time
* and therefore can't ever match */
for (i = 0; i < server_config.max_leases; i++) {
- if (g_leases[i].expires < oldest_time) {
+ if (g_leases[i].expires == 0 /* empty entry */
+ || g_leases[i].expires < oldest_time
+ ) {
oldest_time = g_leases[i].expires;
oldest_lease = &g_leases[i];
}