curl-library
curl crash in Curl_safefree on windows
Date: Wed, 16 Sep 2009 21:27:56 +0530
Hi,
i am running libcurl 7.19.3 compiled with openssl and libssh2 support on a
windows xp machine.
i try to post a http request to a url and read the data returned(binary
data).
The code seems to crash randomly in free(). i verified if both the CRT
versions are the same and both are using /MDd switch.
The stack trace is something like
msvcr90d.dll!_free_base(void * pBlock=0x27b6f620) Line 109 + 0x13 bytes C
CPPublishUI.dll!Curl_safefree(void * ptr=0x27b6f620) Line 230 + 0xc bytes
C
CPPublishUI.dll!Curl_close(SessionHandle * data=0x1c9eef80) Line 480 + 0xf
bytes C
CPPublishUI.dll!curl_easy_cleanup(void * curl=0x1c9eef80) Line 555 + 0x9
bytes C
CPPublishUI.dll!DoCurlPost() Line 158 + 0x9 bytes C++
CPPublishUI.dll!CPConnectDialog::UploadFiles() Line 313 + 0x3e bytes C++
.
The code i am using to post the http request is
std::string lHdrString;
std::string lUrlString;
CURLcode lCurlRet = curl_global_init(CURL_GLOBAL_ALL);
if(lCurlRet == 0)
{
CURL *lCurlHandle = curl_easy_init();
if(lCurlHandle)
{
curl_easy_setopt(lCurlHandle,CURLOPT_URL, lUrlString.c_str());
curl_easy_setopt(lCurlHandle,CURLOPT_HEADERFUNCTION, header_callback);
curl_easy_setopt(lCurlHandle,CURLOPT_HEADERDATA,lHeaderData);
curl_easy_setopt(lCurlHandle,CURLOPT_COPYPOSTFIELDS,lHdrString.c_str());
curl_easy_setopt(lCurlHandle,CURLOPT_POST,1L);
curl_easy_setopt(lCurlHandle,CURLOPT_SSL_VERIFYPEER,0L);
curl_easy_setopt(lCurlHandle,CURLOPT_SSL_VERIFYHOST,0L);
curl_easy_setopt(lCurlHandle,CURLOPT_WRITEFUNCTION,write_callback);
curl_easy_setopt(lCurlHandle,CURLOPT_WRITEDATA,aWriteObserver);
lCurlRet = curl_easy_perform(lCurlHandle); // BOOM SOMETIMES
curl_easy_cleanup(lCurlHandle); // BOOM SOMETIMES
}
curl_global_cleanup(); // BOOM SOMETIMES
Any Sugggestions ?
Thanks
Gokul
-- Better to get up late and be wide awake than to get up early and be asleep all day.Received on 2009-09-16