mirror of
https://github.com/espressif/esp-protocols.git
synced 2025-07-21 14:32:21 +02:00
mdns: fix memory leak when query for service receives multiple ptr entries for one instance
fixes redmine issue 27300 * Original commit: espressif/esp-idf@9a4da97fb4
This commit is contained in:
committed by
suren-gabrielyan-espressif
parent
358d26c8a1
commit
6582b41cd1
@ -2741,8 +2741,10 @@ void mdns_parse_packet(mdns_rx_packet_t * packet)
|
|||||||
|
|
||||||
if (search_result) {
|
if (search_result) {
|
||||||
if (search_result->type == MDNS_TYPE_PTR) {
|
if (search_result->type == MDNS_TYPE_PTR) {
|
||||||
|
if (!result->hostname) { // assign host/port for this entry only if not previously set
|
||||||
result->port = port;
|
result->port = port;
|
||||||
result->hostname = strdup(name->host);
|
result->hostname = strdup(name->host);
|
||||||
|
}
|
||||||
} else {
|
} else {
|
||||||
_mdns_search_result_add_srv(search_result, name->host, port, packet->tcpip_if, packet->ip_protocol);
|
_mdns_search_result_add_srv(search_result, name->host, port, packet->tcpip_if, packet->ip_protocol);
|
||||||
}
|
}
|
||||||
|
Reference in New Issue
Block a user