summaryrefslogtreecommitdiffstats
path: root/lib/altsvc.c
diff options
context:
space:
mode:
Diffstat (limited to 'lib/altsvc.c')
-rw-r--r--lib/altsvc.c10
1 files changed, 4 insertions, 6 deletions
diff --git a/lib/altsvc.c b/lib/altsvc.c
index 22b0b69..35450d6 100644
--- a/lib/altsvc.c
+++ b/lib/altsvc.c
@@ -97,7 +97,7 @@ static struct altsvc *altsvc_createid(const char *srchost,
unsigned int srcport,
unsigned int dstport)
{
- struct altsvc *as = calloc(sizeof(struct altsvc), 1);
+ struct altsvc *as = calloc(1, sizeof(struct altsvc));
size_t hlen;
size_t dlen;
if(!as)
@@ -123,15 +123,13 @@ static struct altsvc *altsvc_createid(const char *srchost,
dlen -= 2;
}
- as->src.host = Curl_memdup(srchost, hlen + 1);
+ as->src.host = Curl_strndup(srchost, hlen);
if(!as->src.host)
goto error;
- as->src.host[hlen] = 0;
- as->dst.host = Curl_memdup(dsthost, dlen + 1);
+ as->dst.host = Curl_strndup(dsthost, dlen);
if(!as->dst.host)
goto error;
- as->dst.host[dlen] = 0;
as->src.alpnid = srcalpnid;
as->dst.alpnid = dstalpnid;
@@ -301,7 +299,7 @@ static CURLcode altsvc_out(struct altsvc *as, FILE *fp)
*/
struct altsvcinfo *Curl_altsvc_init(void)
{
- struct altsvcinfo *asi = calloc(sizeof(struct altsvcinfo), 1);
+ struct altsvcinfo *asi = calloc(1, sizeof(struct altsvcinfo));
if(!asi)
return NULL;
Curl_llist_init(&asi->list, NULL);