From: Kedar Sovani Date: Thu, 30 Nov 2017 06:04:54 +0000 (+0530) Subject: Minor fixes X-Git-Tag: v3.1-beta1~286^2~12 X-Git-Url: https://granicus.if.org/sourcecode?a=commitdiff_plain;h=eb051fe72f3283d4315737b3adc98a650a2900e8;p=esp-idf Minor fixes --- diff --git a/components/esp-tls/esp-tls.c b/components/esp-tls/esp-tls.c index 8822a3dcf5..9906fdbf79 100644 --- a/components/esp-tls/esp-tls.c +++ b/components/esp-tls/esp-tls.c @@ -26,12 +26,10 @@ static struct addrinfo *resolve_host_name(const char *host, size_t hostlen) hints.ai_family = AF_UNSPEC; hints.ai_socktype = SOCK_STREAM; - char *use_host = (char *)calloc(1, hostlen + 1); + char *use_host = strndup(host, hostlen); if (!use_host) { return NULL; } - strncpy(use_host, host, hostlen); - use_host[hostlen] = '\0'; ESP_LOGD(TAG, "host:%s: strlen %zu\n", use_host, hostlen); struct addrinfo *res;