cURL / Mailing Lists / curl-library / Single Mail

curl-library

Segfault during curl_easy_init()

From: Cody Maggard <cody.maggard_at_ttu.edu>
Date: Fri, 01 Apr 2005 01:24:28 -0600

I'm using the following chunk of code to try and create a new session,
but the program crashes on the call of curl_easy_init().

int main(int argc, char *argv[])
{
    int x;
    x = curl_global_init(CURL_GLOBAL_ALL);
    if ( x != 0 ) printf("Global Init Error: %i\n\n",x);
    CURL* session;

    session = curl_easy_init(); // Crashes Here
    if (session == NULL) { printf("Init error\n"); system("pause");
return 0; }

    curl_easy_cleanup(session);
    return EXIT_SUCCESS;
}

It only seems to crash when I try to assign the return value of
curl_easy_init() to session though; when I take out the assignment part
and just leave the function call, the program prints out "Init error"
and quits like it should.

I'm using Dev-Cpp and the mingw32 ssl devel build dll, no warnings or
anything like that upon compile.

Any ideas as to what might be going wrong (or I might be doing wrong)
are appreciated.
Received on 2005-04-01