mirror of
https://git.savannah.nongnu.org/git/lwip.git
synced 2026-05-23 08:37:02 +08:00
dns: Fix dns_alloc_pcb for reuse an existing one case
The logic to use an already existing pcb is wrong because the idx never advanced in the for loop, so it keep checking the same dns_pcbs[idx] for each loop iteration. Fix it. Signed-off-by: Axel Lin <axel.lin@ingics.com>
This commit is contained in:
@@ -851,8 +851,7 @@ dns_alloc_pcb(void)
|
||||
}
|
||||
/* if we come here, creating a new UDP pcb failed, so we have to use
|
||||
an already existing one */
|
||||
idx = dns_last_pcb_idx + 1;
|
||||
for (i = 0; i < DNS_MAX_SOURCE_PORTS; i++) {
|
||||
for (i = 0, idx = dns_last_pcb_idx + 1; i < DNS_MAX_SOURCE_PORTS; i++, idx++) {
|
||||
if (idx >= DNS_MAX_SOURCE_PORTS) {
|
||||
idx = 0;
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user