cURL / Mailing Lists / curl-users / Single Mail

curl-users

libcurl crash on app startup

From: Alexis Oldroyd <alexis.oldroyd_at_gmail.com>
Date: Thu, 25 Sep 2008 11:21:53 -0500

I have libcurl statically compiled into my application. I'm using Visual
Studio 2008 and after getting the error I updated my libcurl to 7.19.0 and
it still occurs.

The first thing in my applications startup I do is call
curl_global_init(CURL_GLOBAL_DEFAULT);

It seems that some users of my application are reporting that when starting
my software, they are crashing, and the address of the crash is always at
the same spot in libcurl. It is in a thread I believe libcurl uses but am
not sure exactly why the error occurs and was hoping someone could point me
into the right direction. The error occurs usually at startup if at all,
once it starts the application seems to run fine.

 

The offending code is in llist.c in function Curl_llist_insert_next:

 

 

struct curl_llist_element *ne =

    (struct curl_llist_element *) malloc(sizeof(struct curl_llist_element));

  if(!ne)

    return 0;

 

  ne->ptr = (void *) p;

  if(list->size == 0) {

    list->head = ne;

    list->head->prev = NULL;

    list->head->next = NULL;

    list->tail = ne;

  }

  else {

    ne->next = e->next; -- Crash here, e is 0x0

    ne->prev = e;

    if(e->next) {

      e->next->prev = ne;

    }

    else {

      list->tail = ne;

    }

    e->next = ne;

  }

 

 

Call Stack

 

                Client.exe!Curl_llist_insert_next(curl_llist *
list=0x008b3058, curl_llist_element * e=0x00000000, const void *
p=0x03be10a8) Line 78 C

                Client.exe!Curl_hash_add(curl_hash * h=0x008b3058, void *
key=0x03be0fe8, unsigned int key_len=0x00000000, void * p=0x03be1050) Line
159 + 0x15 bytes C

                Client.exe!Curl_cache_addr(SessionHandle * data=0x02eeffe8,
Curl_addrinfo * addr=0x03be0eb8, const char * hostname=0x00000000, int
port=0x00000000) Line 348 + 0x1a bytes C

                Client.exe!gethostbyname_thread(void * arg=) Line 267 +
0x49 bytes C

                Client.exe!_callthreadstartex() Line 348 + 0x6 bytes
C

> Client.exe!_threadstartex(void * ptd=0x03be0378) Line 326 +
0x5 bytes C

 

-------------------------------------------------------------------
List admin: http://cool.haxx.se/cgi-bin/mailman/listinfo/curl-users
FAQ: http://curl.haxx.se/docs/faq.html
Etiquette: http://curl.haxx.se/mail/etiquette.html
Received on 2008-09-25