cURL / Mailing Lists / curl-library / Single Mail

curl-library

Crash with curl_easy_duphandle() and ares

From: James Bursa <james_at_semichrome.net>
Date: Wed, 28 Apr 2004 23:43:28 +0100

I'm getting a crash when I use curl_easy_duphandle() with a libcurl configured
to use ares. This is on Linux, but I think that a crash I'm getting on RISC OS
is the same problem.

I am using latest CVS, with ./configure --disable-shared --disable-ipv6
--enable-ares --enable-debug --without-ssl

The minimal test case is this:
_____________________________________________________________________

#include <assert.h>
#include "curl/curl.h"

int main(void)
{
        CURLcode code;
        CURL *curl;
        CURL *curl2;

        code = curl_global_init(CURL_GLOBAL_ALL);
        assert(code == CURLE_OK);

        curl = curl_easy_init();
        assert(curl);

        curl2 = curl_easy_duphandle(curl);
        assert(curl2);

        code = curl_easy_setopt(curl2, CURLOPT_URL, "http://www.google.com/");
        assert(code == CURLE_OK);

        code = curl_easy_perform(curl2);
        assert(code == CURLE_OK);

        return 0;
}
_____________________________________________________________________

Gdb shows a Segmentation fault in ares_gethostbyname():

Program received signal SIGSEGV, Segmentation fault.
0x0806dd36 in ares_gethostbyname (channel=0x0, name=0x808c194 "www.google.com", family=2, callback=0x8062248 <Curl_addrinfo_callback>, arg=0x808baf4)
    at ares_gethostbyname.c:90
90 hquery->remaining_lookups = channel->lookups;
(gdb) bt
#0 0x0806dd36 in ares_gethostbyname (channel=0x0, name=0x808c194 "www.google.com", family=2, callback=0x8062248 <Curl_addrinfo_callback>, arg=0x808baf4)
    at ares_gethostbyname.c:90
#1 0x08062230 in Curl_getaddrinfo (conn=0x808baf4, hostname=0x808c194 "www.google.com", port=80, waitp=0xbffff19c) at hostares.c:289
#2 0x0804b378 in Curl_resolv (conn=0x808baf4, hostname=0x808c194 "www.google.com", port=80, entry=0xbffff9b0) at hostip.c:431
#3 0x08052747 in CreateConnection (data=0x80835ec, in_connect=0xbffffa5c, addr=0xbffffa20, async=0xbffffa53 "") at url.c:3118
#4 0x08052b2b in Curl_connect (data=0x80835ec, in_connect=0xbffffa5c, asyncp=0xbffffa53 "") at url.c:3285
#5 0x0805dc1c in Curl_perform (data=0x80835ec) at transfer.c:1952
#6 0x08049e64 in curl_easy_perform (curl=0x80835ec) at easy.c:325
#7 0x08049b7a in main () at curltest.c:22

Is this a bug, or am I doing something wrong?

Thanks!
James
Received on 2004-04-29