cURL / Mailing Lists / curl-library / Single Mail


Re: elusive cache bug

From: Daniel Stenberg <>
Date: Mon, 15 Dec 2003 15:47:02 +0100 (CET)

On Sun, 14 Dec 2003, Giuseppe Attardi wrote:

> Another memory bug detected by valgrind:
> ==15419== Invalid read of size 4
> ==15419== at 0x81339CF: Curl_do (url.c:3318)

What libcurl version is this? I can't find one that has anything that can fail
on line 3318 in url.c?

> One problem seems due to Curl_do() in url.c. After Curl_done(), the old conn
> has been freed, so it should no longer be used. Curl_connect() creates a new
> one in *connp. Below I have added the assignement conn = *connp:

Yes, this seems like the correct thing to do. Very good catch!

> However this still does not explain how the freed connection survives and
> gets used again in curl_multi_perform().

It works, because Curl_connect() writes the new pointer to the address of the
struct field that was pass onto it correctly from multi.c and its invoke of
Curl_do(). This error is only present locally in Curl_do() after Curl_done()
was invoked.

    Daniel Stenberg -- --
   [[ Do not send mails to this email address. They won't reach me. ]]
This email is sponsored by: IBM Linux Tutorials.
Become an expert in LINUX or just sharpen your skills.  Sign up for IBM's
Free Linux Tutorials.  Learn everything from the bash shell to sys admin.
Click now!
Received on 2003-12-15