[sheepdog] [PATCH stable-0.8 1/2] sheepfs/http: fix variable uninitialized in curl_get_object_size

Hitoshi Mitake mitake.hitoshi at lab.ntt.co.jp
Wed Jun 4 04:27:03 CEST 2014


From: Ruoyu <liangry at ucweb.com>

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>
Signed-off-by: Liu Yuan <namei.unix at gmail.com>
---
 sheepfs/http.c |    2 +-
 1 files changed, 1 insertions(+), 1 deletions(-)

diff --git a/sheepfs/http.c b/sheepfs/http.c
index 2ff3cbe..c290d07 100644
--- a/sheepfs/http.c
+++ b/sheepfs/http.c
@@ -72,7 +72,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.7.1




More information about the sheepdog mailing list