mirror of
https://github.com/espressif/esp-protocols.git
synced 2025-07-23 07:17:29 +02:00
committed by
suren-gabrielyan-espressif
parent
c8b0d5ea9d
commit
6258edf23b
@ -2315,9 +2315,7 @@ static mdns_service_t * _mdns_create_service(const char * service, const char *
|
|||||||
if (hostname) {
|
if (hostname) {
|
||||||
s->hostname = strndup(hostname, MDNS_NAME_BUF_LEN - 1);
|
s->hostname = strndup(hostname, MDNS_NAME_BUF_LEN - 1);
|
||||||
if (!s->hostname) {
|
if (!s->hostname) {
|
||||||
free((char *)s->instance);
|
goto fail;
|
||||||
free(s);
|
|
||||||
return NULL;
|
|
||||||
}
|
}
|
||||||
} else {
|
} else {
|
||||||
s->hostname = NULL;
|
s->hostname = NULL;
|
||||||
@ -2325,20 +2323,27 @@ static mdns_service_t * _mdns_create_service(const char * service, const char *
|
|||||||
|
|
||||||
s->service = strndup(service, MDNS_NAME_BUF_LEN - 1);
|
s->service = strndup(service, MDNS_NAME_BUF_LEN - 1);
|
||||||
if (!s->service) {
|
if (!s->service) {
|
||||||
free((char *)s->instance);
|
goto fail;
|
||||||
free(s);
|
|
||||||
return NULL;
|
|
||||||
}
|
}
|
||||||
|
|
||||||
s->proto = strndup(proto, MDNS_NAME_BUF_LEN - 1);
|
s->proto = strndup(proto, MDNS_NAME_BUF_LEN - 1);
|
||||||
if (!s->proto) {
|
if (!s->proto) {
|
||||||
free((char *)s->instance);
|
|
||||||
free((char *)s->service);
|
free((char *)s->service);
|
||||||
free(s);
|
goto fail;
|
||||||
return NULL;
|
|
||||||
}
|
}
|
||||||
|
|
||||||
return s;
|
return s;
|
||||||
|
|
||||||
|
fail:
|
||||||
|
if (s->instance) {
|
||||||
|
free(s->instance);
|
||||||
|
}
|
||||||
|
if (s->hostname) {
|
||||||
|
free(s->hostname);
|
||||||
|
}
|
||||||
|
free(s);
|
||||||
|
|
||||||
|
return NULL;
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
|
Reference in New Issue
Block a user