mirror of
https://github.com/lwip-tcpip/lwip.git
synced 2024-12-30 15:15:05 +00: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:
parent
29553ba7a1
commit
668d461104
@ -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;
|
||||
}
|
||||
|
Loading…
Reference in New Issue
Block a user