mirror of
https://github.com/espressif/esp-protocols.git
synced 2025-07-23 15:27:28 +02:00
Fix deadly mdns crash
This commit is contained in:
@ -1614,18 +1614,20 @@ static void _mdns_remove_scheduled_answer(mdns_if_t tcpip_if, mdns_ip_protocol_t
|
|||||||
while (q) {
|
while (q) {
|
||||||
if (q->tcpip_if == tcpip_if && q->ip_protocol == ip_protocol && q->distributed) {
|
if (q->tcpip_if == tcpip_if && q->ip_protocol == ip_protocol && q->distributed) {
|
||||||
mdns_out_answer_t *a = q->answers;
|
mdns_out_answer_t *a = q->answers;
|
||||||
if (a->type == type && a->service == service->service) {
|
if (a) {
|
||||||
q->answers = q->answers->next;
|
if (a->type == type && a->service == service->service) {
|
||||||
free(a);
|
q->answers = q->answers->next;
|
||||||
} else {
|
free(a);
|
||||||
while (a->next) {
|
} else {
|
||||||
if (a->next->type == type && a->next->service == service->service) {
|
while (a->next) {
|
||||||
mdns_out_answer_t *b = a->next;
|
if (a->next->type == type && a->next->service == service->service) {
|
||||||
a->next = b->next;
|
mdns_out_answer_t *b = a->next;
|
||||||
free(b);
|
a->next = b->next;
|
||||||
break;
|
free(b);
|
||||||
|
break;
|
||||||
|
}
|
||||||
|
a = a->next;
|
||||||
}
|
}
|
||||||
a = a->next;
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
Reference in New Issue
Block a user