From e7d19dd8881fecb9b72dcd4559bcb4558eef33ec Mon Sep 17 00:00:00 2001 From: Otavio Pontes Date: Mon, 11 Feb 2019 12:35:55 -0800 Subject: [PATCH] curl: Check for errors before using value from curl_easy_getinfo call Signed-off-by: Otavio Pontes --- src/curl.c | 7 ++++--- 1 file changed, 4 insertions(+), 3 deletions(-) diff --git a/src/curl.c b/src/curl.c index f55218fe..457fd82a 100644 --- a/src/curl.c +++ b/src/curl.c @@ -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) {