]> granicus.if.org Git - esp-idf/commitdiff
Minor fixes
authorKedar Sovani <kedars@gmail.com>
Thu, 30 Nov 2017 06:04:54 +0000 (11:34 +0530)
committerJitin George <jitin@espressif.com>
Fri, 6 Apr 2018 11:43:14 +0000 (17:13 +0530)
components/esp-tls/esp-tls.c

index 8822a3dcf56dc88e02793bb04789b69ba3aff286..9906fdbf791c4c1b85bf68f9a404bcbcc1ea9b15 100644 (file)
@@ -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;