diff options
Diffstat (limited to 'libs/libcurl/src/altsvc.c')
| -rw-r--r-- | libs/libcurl/src/altsvc.c | 11 |
1 files changed, 5 insertions, 6 deletions
diff --git a/libs/libcurl/src/altsvc.c b/libs/libcurl/src/altsvc.c index 13d4f11b71..f410c2e7b2 100644 --- a/libs/libcurl/src/altsvc.c +++ b/libs/libcurl/src/altsvc.c @@ -106,9 +106,11 @@ static struct altsvc *altsvc_createid(const char *srchost, dlen = strlen(dsthost);
DEBUGASSERT(hlen);
DEBUGASSERT(dlen);
- if(!hlen || !dlen)
+ if(!hlen || !dlen) {
/* bad input */
+ free(as);
return NULL;
+ }
if((hlen > 2) && srchost[0] == '[') {
/* IPv6 address, strip off brackets */
srchost++;
@@ -123,11 +125,11 @@ static struct altsvc *altsvc_createid(const char *srchost, dlen -= 2;
}
- as->src.host = Curl_strndup(srchost, hlen);
+ as->src.host = Curl_memdup0(srchost, hlen);
if(!as->src.host)
goto error;
- as->dst.host = Curl_strndup(dsthost, dlen);
+ as->dst.host = Curl_memdup0(dsthost, dlen);
if(!as->dst.host)
goto error;
@@ -333,9 +335,6 @@ CURLcode Curl_altsvc_load(struct altsvcinfo *asi, const char *file) CURLcode Curl_altsvc_ctrl(struct altsvcinfo *asi, const long ctrl)
{
DEBUGASSERT(asi);
- if(!ctrl)
- /* unexpected */
- return CURLE_BAD_FUNCTION_ARGUMENT;
asi->flags = ctrl;
return CURLE_OK;
}
|
