cURL / Mailing Lists / curl-library / Single Mail

curl-library

Re: [patch] libcurl 7.12.2-20040917 and CURLOPT_VERBOSE may read free()ed data

From: Bertrand Demiddelaer <bdemiddelaer_at_denyall.com>
Date: Wed, 29 Sep 2004 14:32:59 +0200

Daniel Stenberg wrote:

> Curl_done() gets called after each transfer on a connection, while
> Curl_disconnect() is called when the connection is disconnected after
> one or more transfers.

That's how I understand libcurl code.

>> As you seem to disagree with this patch, I made tests this morning
>> with verbosed pruning functions: my entries do get pruned (and they
>> really get pruned when the socket disconnects).
>
>
> I fail to understand how that is possible. Unless the connection is told
> to get closed, you don't call resolv_unlock() for that dns entry. Why
> isn't that entry then remaining locked?

That's exactly what I want: a resolv_unlock() call when the connection
is closed.

My primarily goal is to decrease inuse counter when the connection is
closed and not when the host is resolved, or a single request is done.
This, in order to solve the initial problem: preventing verboseconnect()
from using an invalid conn->ip_addr (which is fed with conn->dns_entry
elements in Curl_connecthost(), but conn->dns_entry can get pruned by a
concurrent handler in curl_multi and curl_share context).

You are right to notice that a side effect of this new behaviour is that
entries in dns cache can remain valid longer, but they finally get
pruned when every connection using them is closed.

Anyway, I hope this helps to make my goal clearer.
Received on 2004-09-29