fix(lwip): fixed the dhcp pool error on dhcp server

This commit is contained in:
zhangyanjiao
2024-05-21 17:02:55 +08:00
committed by BOT
parent 3fd3c37507
commit eaef3a2683

View File

@ -1,5 +1,5 @@
/* /*
* SPDX-FileCopyrightText: 2015-2023 Espressif Systems (Shanghai) CO LTD * SPDX-FileCopyrightText: 2015-2024 Espressif Systems (Shanghai) CO LTD
* *
* SPDX-License-Identifier: Apache-2.0 * SPDX-License-Identifier: Apache-2.0
*/ */
@ -1424,7 +1424,7 @@ static void kill_oldest_dhcps_pool(dhcps_t *dhcps)
assert(pre != NULL && pre->pnext != NULL); // Expect the list to have at least 2 nodes assert(pre != NULL && pre->pnext != NULL); // Expect the list to have at least 2 nodes
p = pre->pnext; p = pre->pnext;
minpre = pre; minpre = pre;
minp = p; minp = pre;
while (p != NULL) { while (p != NULL) {
pdhcps_pool = p->pnode; pdhcps_pool = p->pnode;
@ -1438,8 +1438,11 @@ static void kill_oldest_dhcps_pool(dhcps_t *dhcps)
pre = p; pre = p;
p = p->pnext; p = p->pnext;
} }
if (minp == dhcps->plist) {
minpre->pnext = minp->pnext; dhcps->plist = minp->pnext;
} else {
minpre->pnext = minp->pnext;
}
free(minp->pnode); free(minp->pnode);
minp->pnode = NULL; minp->pnode = NULL;
free(minp); free(minp);