curl: Check for errors before using value from curl_easy_getinfo call

Signed-off-by: Otavio Pontes <otavio.pontes@intel.com>
This commit is contained in:
Otavio Pontes
2019-02-12 15:07:25 -08:00
parent 71b334159a
commit e7d19dd888
+4 -3
View File
@@ -365,9 +365,10 @@ enum download_status process_curl_error_codes(int curl_ret, CURL *curl_handle)
/*
* retrieve bytes transferred, errors or not
*/
curl_off_t curl_sz;
curl_easy_getinfo(curl_handle, CURLINFO_SIZE_DOWNLOAD_T, &curl_sz);
total_curl_sz += curl_sz;
curl_off_t curl_sz = 0;
if (curl_easy_getinfo(curl_handle, CURLINFO_SIZE_DOWNLOAD_T, &curl_sz) == CURLE_OK) {
total_curl_sz += curl_sz;
}
if (curl_ret == CURLE_OK || curl_ret == CURLE_HTTP_RETURNED_ERROR ||
curl_ret == CURLE_RECV_ERROR) {