mirror of
https://github.com/espressif/esp-idf.git
synced 2024-10-05 20:47:46 -04:00
Merge branch 'bugfix/mdns_service_memory_leak' into 'master'
mdns: fix memory leak when query for service plus various other fixes See merge request idf/esp-idf!4270
This commit is contained in:
commit
5b945cb611
@ -2741,8 +2741,10 @@ void mdns_parse_packet(mdns_rx_packet_t * packet)
|
||||
|
||||
if (search_result) {
|
||||
if (search_result->type == MDNS_TYPE_PTR) {
|
||||
result->port = port;
|
||||
result->hostname = strdup(name->host);
|
||||
if (!result->hostname) { // assign host/port for this entry only if not previously set
|
||||
result->port = port;
|
||||
result->hostname = strdup(name->host);
|
||||
}
|
||||
} else {
|
||||
_mdns_search_result_add_srv(search_result, name->host, port, packet->tcpip_if, packet->ip_protocol);
|
||||
}
|
||||
@ -2829,7 +2831,10 @@ void mdns_parse_packet(mdns_rx_packet_t * packet)
|
||||
}
|
||||
}
|
||||
} else {
|
||||
_mdns_search_result_add_txt(search_result, txt, txt_count, packet->tcpip_if, packet->ip_protocol);
|
||||
_mdns_result_txt_create(data_ptr, data_len, &txt, &txt_count);
|
||||
if (txt_count) {
|
||||
_mdns_search_result_add_txt(search_result, txt, txt_count, packet->tcpip_if, packet->ip_protocol);
|
||||
}
|
||||
}
|
||||
} else if (ours) {
|
||||
if (parsed_packet->questions && !parsed_packet->probe) {
|
||||
@ -4015,8 +4020,6 @@ static esp_err_t _mdns_service_task_stop()
|
||||
MDNS_SERVICE_LOCK();
|
||||
_mdns_stop_timer();
|
||||
MDNS_SERVICE_UNLOCK();
|
||||
vSemaphoreDelete(_mdns_service_semaphore);
|
||||
_mdns_service_semaphore = NULL;
|
||||
if (_mdns_service_task_handle) {
|
||||
mdns_action_t action;
|
||||
mdns_action_t * a = &action;
|
||||
@ -4029,6 +4032,8 @@ static esp_err_t _mdns_service_task_stop()
|
||||
vTaskDelay(10 / portTICK_PERIOD_MS);
|
||||
}
|
||||
}
|
||||
vSemaphoreDelete(_mdns_service_semaphore);
|
||||
_mdns_service_semaphore = NULL;
|
||||
return ESP_OK;
|
||||
}
|
||||
|
||||
|
@ -301,6 +301,7 @@ static err_t _mdns_udp_pcb_write_api(struct tcpip_api_call_data *api_call_msg)
|
||||
mdns_pcb_t * _pcb = &_mdns_server->interfaces[msg->tcpip_if].pcbs[msg->ip_protocol];
|
||||
esp_err_t err = tcpip_adapter_get_netif(msg->tcpip_if, &nif);
|
||||
if (err) {
|
||||
pbuf_free(msg->pbt);
|
||||
msg->err = err;
|
||||
return err;
|
||||
}
|
||||
|
@ -147,7 +147,7 @@ static void mdns_print_results(mdns_result_t * results){
|
||||
}
|
||||
a = r->addr;
|
||||
while(a){
|
||||
if(a->addr.type == MDNS_IP_PROTOCOL_V6){
|
||||
if(a->addr.type == IPADDR_TYPE_V6){
|
||||
printf(" AAAA: " IPV6STR "\n", IPV62STR(a->addr.u_addr.ip6));
|
||||
} else {
|
||||
printf(" A : " IPSTR "\n", IP2STR(&(a->addr.u_addr.ip4)));
|
||||
|
Loading…
Reference in New Issue
Block a user