curl-library
Re: segfault in hash.c
Date: Sun, 14 Sep 2003 14:11:48 +0200 (CEST)
On Sat, 13 Sep 2003, Jeff Pohlmeyer wrote:
> I think I see the problem:
>
> When Curl_hash_add() finds a duplicate entry in the hostcache, it frees the
> existing entry, and then assigns the new dns record to the existing
> hostname. But it does not check to see if the existing entry is in use by
> another easy handle before freeing it.
Very nice tracking work, Jeff! This is indeed badness.
> This patch seems to solve the problem, but I didn't check to see if it
> creates a memory leak or not:
It will cause a memory leak. I think an even better fix would be to free the
new struct instead of the old one, and return a pointer to the existing one
for the parent function to use instead.
I'll work on a proper way to do that and verify that your test program runs
fine with that fix.
Thanks!
There was also another problem in hostip.c that Bjorn Reese tracked down.
Fixed in this patch:
http://cvs.php.net/diff.php/curl/lib/hostip.c?sbt=1&r1=1.97&r2=1.98&ty=u
-- Daniel Stenberg -- curl: been grokking URLs since 1998 ------------------------------------------------------- This sf.net email is sponsored by:ThinkGeek Welcome to geek heaven. http://thinkgeek.com/sfReceived on 2003-09-14