cURL / Mailing Lists / curl-library / Single Mail

curl-library

Re: Crash with curl_easy_duphandle() and ares

From: Daniel Stenberg <daniel-curl_at_haxx.se>
Date: Thu, 29 Apr 2004 12:59:25 +0200 (CEST)

On Wed, 28 Apr 2004, James Bursa wrote:

> 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 just now added test case 512. It failed the exact same way you showed, and
with the fix below it runs fine:

diff -u -r1.52 easy.c
--- easy.c 27 Apr 2004 15:19:28 -0000 1.52
+++ easy.c 29 Apr 2004 10:57:17 -0000
@@ -374,6 +374,14 @@
   /* start with clearing the entire new struct */
   memset(outcurl, 0, sizeof(struct SessionHandle));

+#ifdef USE_ARES
+ /* If we use ares, we need to setup a new ares channel for the new handle
*/
+ if(ARES_SUCCESS != ares_init(&outcurl->state.areschannel)) {
+ free(outcurl);
+ return NULL;
+ }
+#endif
+
   /*
    * We setup a few buffers we need. We should probably make them
    * get setup on-demand in the code, as that would probably decrease

-- 
     Daniel Stenberg -- http://curl.haxx.se -- http://daniel.haxx.se
      Dedicated custom curl help for hire: http://haxx.se/curl.html
Received on 2004-04-29