summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorSiva Sivaraman <kasivara@microsoft.com>2020-05-18 08:59:47 -0700
committerDaniel Stenberg <daniel@haxx.se>2020-05-19 08:53:41 +0200
commitc4df1f75ad6a90c70dc96e7b183be066465014ec (patch)
tree4e295ec1bf35c696205bfbd9f9dcf0200a90b39b
parent557dde201c9998a6295939335cbfdffb2373bee1 (diff)
downloadcurl-c4df1f75ad6a90c70dc96e7b183be066465014ec.tar.gz
tool_operate: fixed potentially uninitialized variables
... in curl_easy_getinfo() calls. They're harmless but clearing the variables makes the code safer and comforts the reader. Closes #5416
-rw-r--r--src/tool_operate.c10
1 files changed, 5 insertions, 5 deletions
diff --git a/src/tool_operate.c b/src/tool_operate.c
index e6d346067..5d3ac7afe 100644
--- a/src/tool_operate.c
+++ b/src/tool_operate.c
@@ -444,7 +444,7 @@ static CURLcode post_per_transfer(struct GlobalConfig *global,
RETRY_FTP,
RETRY_LAST /* not used */
} retry = RETRY_NO;
- long response;
+ long response = 0;
if((CURLE_OPERATION_TIMEDOUT == result) ||
(CURLE_COULDNT_RESOLVE_HOST == result) ||
(CURLE_COULDNT_RESOLVE_PROXY == result) ||
@@ -453,7 +453,7 @@ static CURLcode post_per_transfer(struct GlobalConfig *global,
retry = RETRY_TIMEOUT;
else if(config->retry_connrefused &&
(CURLE_COULDNT_CONNECT == result)) {
- long oserrno;
+ long oserrno = 0;
curl_easy_getinfo(curl, CURLINFO_OS_ERRNO, &oserrno);
if(ECONNREFUSED == oserrno)
retry = RETRY_CONNREFUSED;
@@ -464,7 +464,7 @@ static CURLcode post_per_transfer(struct GlobalConfig *global,
/* If it returned OK. _or_ failonerror was enabled and it
returned due to such an error, check for HTTP transient
errors to retry on. */
- long protocol;
+ long protocol = 0;
curl_easy_getinfo(curl, CURLINFO_PROTOCOL, &protocol);
if((protocol == CURLPROTO_HTTP) || (protocol == CURLPROTO_HTTPS)) {
/* This was HTTP(S) */
@@ -492,7 +492,7 @@ static CURLcode post_per_transfer(struct GlobalConfig *global,
}
} /* if CURLE_OK */
else if(result) {
- long protocol;
+ long protocol = 0;
curl_easy_getinfo(curl, CURLINFO_RESPONSE_CODE, &response);
curl_easy_getinfo(curl, CURLINFO_PROTOCOL, &protocol);
@@ -589,7 +589,7 @@ static CURLcode post_per_transfer(struct GlobalConfig *global,
else if(per->metalink) {
/* Metalink: Decide to try the next resource or not. Try the next resource
if download was not successful. */
- long response;
+ long response = 0;
if(CURLE_OK == result) {
/* TODO We want to try next resource when download was
not successful. How to know that? */