cURL / Mailing Lists / curl-library / Single Mail

curl-library

Libcurl crashes in getaddrinfo

From: <ak1mbox-jxta_at_yahoo.ca>
Date: Tue, 11 Sep 2007 17:42:53 -0400 (EDT)

Hi,

I've started having trouble with my application
crashing after compiling it statically on linux Ubuntu
2.6.15. The application seems to work fine when
compiled on Windows and semi-stable, crashes
sometimes, when compiled dynamically on linux.

I am using easy-curl. Properly initialize it using
curl_global_init before starting any threads.

The calls that lead to the crash are as follows

CURL* easyhandle = curl_easy_init();
curl_easy_setopt(easyhandle, CURLOPT_POST, 1);
curl_easy_setopt(easyhandle, CURLOPT_POSTFIELDS,
data); //data is a null terminated char array
curl_easy_setopt(easyhandle, CURLOPT_URL, url.c_str()
);
curl_easy_setopt(easyhandle, CURLOPT_WRITEFUNCTION,
_httpcallback);
curl_easy_setopt(easyhandle, CURLOPT_WRITEDATA,
inboundTransport );

struct curl_slist *headers=NULL;
headers = curl_slist_append(headers, "Pragma:
no-cache");
headers = curl_slist_append(headers, "Cache-Control:
no-store, no-cache, must-revalidate");
curl_easy_setopt(easyhandle, CURLOPT_HTTPHEADER,
headers);
curl_easy_perform(easyhandle);

here is the crash stack

==8949== at 0x40803D8: malloc (in
/lib/tls/i686/cmov/libc-2.3.6.so)
==8949== by 0x406F0BE: (within
/lib/tls/i686/cmov/libc-2.3.6.so)
==8949== by 0x406F17C: fopen (in
/lib/tls/i686/cmov/libc-2.3.6.so)
==8949== by 0x4014284: (within
/lib/tls/i686/cmov/libnss_files-2.3.6.so)
==8949== by 0x4014D93: _nss_files_gethostbyname2_r
(in /lib/tls/i686/cmov/libnss_files-2.3.6.so)
==8949== by 0x8486AD0: gaih_inet (in /application)
==8949== by 0x8487A41: getaddrinfo (in
/application)
==8949== by 0x831992B: Curl_getaddrinfo
(hostip6.c:294)
==8949== by 0x83077CF: Curl_resolv (hostip.c:459)
==8949== by 0x830DDDF: Curl_connect (url.c:3817)
==8949== by 0x8314940: Curl_connect_host
(transfer.c:2133)
==8949== by 0x8316A92: Curl_perform
(transfer.c:2222)
call from local code

Really appreciate any help you can provide,

Thank you,

Alex
Received on 2007-09-11