cURL / Mailing Lists / curl-library / Single Mail


Libcurl crashes in getaddrinfo

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


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,
curl_easy_setopt(easyhandle, CURLOPT_WRITEDATA,
inboundTransport );

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

here is the crash stack

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

Really appreciate any help you can provide,

Thank you,

Received on 2007-09-11