]> git.ipfire.org Git - thirdparty/curl.git/commitdiff
url: silence MSVC warning 5638/head
authorMarcel Raad <Marcel.Raad@teamviewer.com>
Thu, 2 Jul 2020 11:23:31 +0000 (13:23 +0200)
committerMarcel Raad <Marcel.Raad@teamviewer.com>
Thu, 2 Jul 2020 11:31:22 +0000 (13:31 +0200)
Since commit f3d501dc678, if proxy support is disabled, MSVC warns:
url.c : warning C4701: potentially uninitialized local variable
'hostaddr' used
url.c : error C4703: potentially uninitialized local pointer variable
'hostaddr' used

That could actually only happen if both `conn->bits.proxy` and
`CURL_DISABLE_PROXY` were enabled.
Initialize it to NULL to silence the warning.

Closes https://github.com/curl/curl/pull/5638

lib/url.c

index a1a6b691039b5c15044b34bb208db9664110d9b5..caeb429a50a7b638dcb4b2e69c7a6fefd4f6ebb6 100644 (file)
--- a/lib/url.c
+++ b/lib/url.c
@@ -3170,7 +3170,7 @@ static CURLcode resolve_server(struct Curl_easy *data,
   else {
     /* this is a fresh connect */
     int rc;
-    struct Curl_dns_entry *hostaddr;
+    struct Curl_dns_entry *hostaddr = NULL;
 
 #ifdef USE_UNIX_SOCKETS
     if(conn->unix_domain_socket) {