Bugfix: Avoid curl from segfaulting when CurlErrBuff is filled. Allocate CurlErrBuff...
authorBjoern Sikora <bjoern.sikora@intra2net.com>
Thu, 17 Sep 2009 15:17:31 +0000 (17:17 +0200)
committerBjoern Sikora <bjoern.sikora@intra2net.com>
Thu, 17 Sep 2009 15:17:31 +0000 (17:17 +0200)
src/httphelper.cpp
src/httphelper.h

index 18aec0a..890388d 100644 (file)
@@ -50,7 +50,6 @@ HTTPHelper::~HTTPHelper()
 {
     // Free memory
     curl_easy_cleanup(CurlEasyHandle);
-    free(CurlErrBuff);
 }
 
 
@@ -73,7 +72,7 @@ long HTTPHelper::http_get(const string& url)
     }
     if ( (curl_err_code = curl_easy_getinfo(CurlEasyHandle,CURLINFO_RESPONSE_CODE,&curl_info)) != 0 )
     {
-         Log->print_curl_error(url,curl_err_code);
+        Log->print_curl_error(url,curl_err_code);
         return -1;
     }
 
index 1f987dc..09701d0 100644 (file)
@@ -26,7 +26,7 @@ private:
     int ProxyPort;
     CURL* CurlEasyHandle;
     std::string CurlWritedataBuff;
-    char* CurlErrBuff;
+    char CurlErrBuff[CURL_ERROR_SIZE];
 
     void set_curl_url(const std::string& url);
     void set_curl_auth(const std::string& username, const std::string& password);