Skip to content

Commit

Permalink
Merge pull request #642 from david-cermak/fix/mdns_coverity
Browse files Browse the repository at this point in the history
[mdns]: Fix recent issues on v1.4 reported by Coverity
  • Loading branch information
david-cermak authored Sep 12, 2024
2 parents 73c4830 + 25b3d5f commit 571a741
Showing 1 changed file with 5 additions and 18 deletions.
23 changes: 5 additions & 18 deletions components/mdns/mdns.c
Original file line number Diff line number Diff line change
Expand Up @@ -5956,11 +5956,6 @@ static mdns_txt_item_t *_copy_mdns_txt_items(mdns_txt_linked_item_t *items, uint
for (mdns_txt_linked_item_t *tmp = items; tmp != NULL; tmp = tmp->next) {
ret_index++;
}
if (ret_index == 0) {
*txt_count = 0;
*txt_value_len = NULL;
return NULL;
}
*txt_count = ret_index;
if (ret_index == 0) { // handle empty TXT
*txt_value_len = NULL;
Expand Down Expand Up @@ -6403,22 +6398,14 @@ esp_err_t mdns_service_remove_for_host(const char *instance, const char *service
if (_mdns_service_match(a->service, service, proto, hostname)) {
if (_mdns_server->services != a) {
b->next = a->next;
_mdns_send_bye(&a, 1, false);
_mdns_remove_scheduled_service_packets(a->service);
_mdns_free_service(a->service);
free(a);
a = b->next;
continue;
} else {
_mdns_server->services = a->next;
_mdns_send_bye(&a, 1, false);
_mdns_remove_scheduled_service_packets(a->service);
_mdns_free_service(a->service);
free(a);
a = _mdns_server->services;
b = a;
continue;
}
_mdns_send_bye(&a, 1, false);
_mdns_remove_scheduled_service_packets(a->service);
_mdns_free_service(a->service);
free(a);
break;
}
b = a;
a = a->next;
Expand Down

0 comments on commit 571a741

Please sign in to comment.