Skip to content

Commit

Permalink
Merge branch 'bugfix/fix_dhcp_pool_issue_on_dhcp_server_v5.2' into 'r…
Browse files Browse the repository at this point in the history
…elease/v5.2'

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

See merge request espressif/esp-idf!31267
  • Loading branch information
jack0c committed Jun 6, 2024
2 parents cc9edf2 + d4c1af3 commit e10eb71
Showing 1 changed file with 7 additions and 4 deletions.
11 changes: 7 additions & 4 deletions components/lwip/apps/dhcpserver/dhcpserver.c
Original file line number Diff line number Diff line change
@@ -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
*/
Expand Down Expand Up @@ -1399,7 +1399,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
p = pre->pnext;
minpre = pre;
minp = p;
minp = pre;

while (p != NULL) {
pdhcps_pool = p->pnode;
Expand All @@ -1413,8 +1413,11 @@ static void kill_oldest_dhcps_pool(dhcps_t *dhcps)
pre = p;
p = p->pnext;
}

minpre->pnext = minp->pnext;
if (minp == dhcps->plist) {
dhcps->plist = minp->pnext;
} else {
minpre->pnext = minp->pnext;
}
free(minp->pnode);
minp->pnode = NULL;
free(minp);
Expand Down

0 comments on commit e10eb71

Please # to comment.