[sheepdog] [PATCH] sheepfs/http: fix variable uninitialized in curl_get_object_size

Ruoyu liangry at ucweb.com
Mon Apr 21 12:37:08 CEST 2014


If curl_easy_init is failure, the variable content_length will be
uninitialized. This will come into unexpected problem.

Signed-off-by: Ruoyu <liangry at ucweb.com>
---
 sheepfs/http.c | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/sheepfs/http.c b/sheepfs/http.c
index 3732db3..0f26983 100644
--- a/sheepfs/http.c
+++ b/sheepfs/http.c
@@ -74,7 +74,7 @@ static uint64_t curl_get_object_size(const char *url)
 {
 	CURL *curl;
 	CURLcode res;
-	double content_length;
+	double content_length = 0;
 
 	curl = curl_easy_init();
 	if (!curl) {
-- 
1.8.3.2





More information about the sheepdog mailing list