cURL / Mailing Lists / curl-library / Single Mail

curl-library

Re: Bugfix for issue 1330310 (SIGSEGV in Curl_removeHandleFromPipeline)

From: Daniel Stenberg <daniel_at_haxx.se>
Date: Mon, 20 Apr 2009 00:46:33 +0200 (CEST)

On Thu, 16 Apr 2009, LÚna´c Lefever wrote:

> Issue 1330310 somehow got unfixed and made libcurl (7.19.4) crash by doing a
> double Curl_done on the same connection (Curl_getoff_all_pipelines gets
> called from Curl_done with conn being NULL).

Ouch. Thanks a lot for your very detailed description and hard work on
tracking this down.

> I've fixed the bug by keeping the original result in an extra CURLCode
> variable and check if this variable is equal to CURLE_SEND_ERROR. I'm sure
> there is a cleaner way to fix this problem than my fast hack.

What about letting the ftp_done() code prioritize the first found error code
and return that back? Like this patch:

diff -u -r1.506 ftp.c
--- lib/ftp.c 19 Apr 2009 05:20:04 -0000 1.506
+++ lib/ftp.c 19 Apr 2009 22:44:06 -0000
@@ -3185,6 +3185,7 @@
      ftpc->cwdfail = TRUE; /* set this TRUE to prevent us to remember the
                               current path, as this connection is going */
      conn->bits.close = TRUE; /* marked for closure */
+ result = status; /* use the already set error code */
      break;
    }

-- 
  / daniel.haxx.se
Received on 2009-04-20