aboutsummaryrefslogtreecommitdiff
path: root/lib/url.c
diff options
context:
space:
mode:
authorJay Satiro <raysatiro@yahoo.com>2019-09-25 14:35:02 +0200
committerDaniel Stenberg <daniel@haxx.se>2019-09-25 14:35:02 +0200
commitaf3ced3b9ceb529da34a3d9fe8193ee01465ee9b (patch)
tree8c415e2b0a00c50909eea5be3b0387f3962dc8cb /lib/url.c
parent7c7dac4dbbf713079facec3ce43bee17fe13ec5f (diff)
url: fix the NULL hostname compiler warning case
Closes #4403
Diffstat (limited to 'lib/url.c')
-rw-r--r--lib/url.c8
1 files changed, 2 insertions, 6 deletions
diff --git a/lib/url.c b/lib/url.c
index e4c47930a..14e6e2625 100644
--- a/lib/url.c
+++ b/lib/url.c
@@ -1870,11 +1870,7 @@ static CURLcode parseurlandfillconn(struct Curl_easy *data,
(void)curl_url_get(uh, CURLUPART_QUERY, &data->state.up.query, 0);
hostname = data->state.up.hostname;
- if(!hostname)
- /* this is for file:// transfers, get a dummy made */
- hostname = (char *)"";
-
- if(hostname[0] == '[') {
+ if(hostname && hostname[0] == '[') {
/* This looks like an IPv6 address literal. See if there is an address
scope. */
size_t hlen;
@@ -1888,7 +1884,7 @@ static CURLcode parseurlandfillconn(struct Curl_easy *data,
}
/* make sure the connect struct gets its own copy of the host name */
- conn->host.rawalloc = strdup(hostname);
+ conn->host.rawalloc = strdup(hostname ? hostname : "");
if(!conn->host.rawalloc)
return CURLE_OUT_OF_MEMORY;
conn->host.name = conn->host.rawalloc;