mdns: fix static analysis warnings
@@ -1312,6 +1312,7 @@ static mdns_tx_packet_t * _mdns_create_probe_packet(tcpip_adapter_if_t tcpip_if,
q->domain = MDNS_DEFAULT_DOMAIN;
if (!q->host || _mdns_question_exists(q, packet->questions)) {
free(q);
+ continue;
} else {
queueToEnd(mdns_out_question_t, packet->questions, q);
}
@@ -2801,7 +2802,7 @@ void mdns_parse_packet(mdns_rx_packet_t * packet)
col = 1;
} else if (!clas) {
col = -1;
- } else {
+ } else if (service) { // only detect srv collision if service existed
col = _mdns_check_srv_collision(service->service, priority, weight, port, name->host, name->domain);
}
if (col && (parsed_packet->probe || parsed_packet->authoritative)) {
@@ -3831,6 +3832,7 @@ static void _mdns_execute_action(mdns_action_t * action)
break;
case ACTION_SERVICE_DEL:
a = _mdns_server->services;
+ if (action->data.srv_del.service) {
if (_mdns_server->services == action->data.srv_del.service) {
_mdns_server->services = a->next;
_mdns_send_bye(&a, 1, false);
@@ -3850,6 +3852,7 @@ static void _mdns_execute_action(mdns_action_t * action)
free(b);
}
}
+ }
break;
case ACTION_SERVICES_CLEAR:
