cURL / Mailing Lists / curl-library / Single Mail

curl-library

Re: multi_runsingle referencing freed connection

From: Daniel Stenberg <daniel_at_haxx.se>
Date: Fri, 16 Feb 2007 23:44:24 +0100 (CET)

On Thu, 15 Feb 2007, Jeff Pohlmeyer wrote:

> As far as I can tell, here is what's happening...

With this patch below applied, I managed to run your proxy for quite some time
without crashing - include that problem site you mentioned before.

Let me know if you find any flaws with this.

--- lib/multi.c 12 Feb 2007 12:15:42 -0000 1.126
+++ lib/multi.c 16 Feb 2007 22:47:56 -0000
@@ -542,11 +542,10 @@
        easy->easy_handle->dns.hostcachetype = HCACHE_NONE;
      }

- /* if we have a connection we must call Curl_done() here so that we
- don't leave a half-baked one around */
- if(easy->easy_conn) {
- /* Set up the association right */
- easy->easy_conn->data = easy->easy_handle;
+ /* we must call Curl_done() here (if we still "own it") so that we don't
+ leave a half-baked one around */
+ if(easy->easy_conn &&
+ (easy->easy_conn->data == easy->easy_handle)) {

        /* Curl_done() clears the conn->data field to lose the association
           between the easy handle and the connection */

-- 
  Commercial curl and libcurl Technical Support: http://haxx.se/curl.html
Received on 2007-02-17