|
4 | 4 | * SPDX-License-Identifier: Apache-2.0 |
5 | 5 | */ |
6 | 6 | #include <string.h> |
| 7 | +#include "sdkconfig.h" |
7 | 8 | #include "mdns_private.h" |
8 | 9 | #include "mdns_mem_caps.h" |
9 | 10 | #include "esp_log.h" |
10 | 11 | #include "mdns_utils.h" |
11 | 12 | #include "mdns_responder.h" |
12 | 13 |
|
| 14 | +static const char *TAG = "mdns_utils"; |
13 | 15 | static const char *MDNS_DEFAULT_DOMAIN = "local"; |
14 | 16 | static const char *MDNS_SUB_STR = "_sub"; |
15 | 17 |
|
@@ -119,7 +121,7 @@ bool mdns_utils_hostname_is_ours(const char *hostname) |
119 | 121 | bool mdns_utils_service_match(const mdns_service_t *srv, const char *service, const char *proto, |
120 | 122 | const char *hostname) |
121 | 123 | { |
122 | | - if (!service || !proto || !srv->hostname) { |
| 124 | + if (!service || !proto || !srv || !srv->hostname) { |
123 | 125 | return false; |
124 | 126 | } |
125 | 127 | return !strcasecmp(srv->service, service) && !strcasecmp(srv->proto, proto) && |
@@ -164,7 +166,7 @@ bool mdns_utils_service_match_instance(const mdns_service_t *srv, const char *in |
164 | 166 | if (!service || !proto) { |
165 | 167 | return false; |
166 | 168 | } |
167 | | - // instance==NULL -> _mdns_instance_name_match() will check the default instance |
| 169 | + // instance==NULL -> mdns_utils_instance_name_match() will check the default instance |
168 | 170 | // hostname==NULL -> matches if instance, service and proto matches |
169 | 171 | return !strcasecmp(srv->service, service) && mdns_utils_instance_name_match(srv->instance, instance) && |
170 | 172 | !strcasecmp(srv->proto, proto) && (mdns_utils_str_null_or_empty(hostname) || !strcasecmp(srv->hostname, hostname)); |
@@ -216,6 +218,7 @@ mdns_ip_addr_t *mdns_utils_copy_address_list(const mdns_ip_addr_t *address_list) |
216 | 218 | while (address_list != NULL) { |
217 | 219 | mdns_ip_addr_t *addr = (mdns_ip_addr_t *)mdns_mem_malloc(sizeof(mdns_ip_addr_t)); |
218 | 220 | if (addr == NULL) { |
| 221 | + HOOK_MALLOC_FAILED; |
219 | 222 | mdns_utils_free_address_list(head); |
220 | 223 | return NULL; |
221 | 224 | } |
|
0 commit comments