aboutsummaryrefslogtreecommitdiff
path: root/lib
diff options
context:
space:
mode:
authorDaniel Stenberg <daniel@haxx.se>2009-02-02 21:36:47 +0000
committerDaniel Stenberg <daniel@haxx.se>2009-02-02 21:36:47 +0000
commitd4ac3d53fc13ec9fdf4e693e4b6fe2539ee6592c (patch)
tree99548facd67afb22420917cb6486934d0912e722 /lib
parentf0332c0b581f4a7af27d54ac1f837beb59a87fdf (diff)
- Patrick Scott found a rather large memory leak when using the multi
interface and setting CURLMOPT_MAXCONNECTS to something less than the number of handles you add to the multi handle. All the connections that didn't fit in the cache would not be properly disconnected nor freed!
Diffstat (limited to 'lib')
-rw-r--r--lib/url.c6
1 files changed, 5 insertions, 1 deletions
diff --git a/lib/url.c b/lib/url.c
index 7cbe3cec0..80d55bd55 100644
--- a/lib/url.c
+++ b/lib/url.c
@@ -4804,8 +4804,12 @@ CURLcode Curl_done(struct connectdata **connp,
state it is for re-using, so we're forced to close it. In a perfect world
we can add code that keep track of if we really must close it here or not,
but currently we have no such detail knowledge.
+
+ connectindex == -1 here means that the connection has no spot in the
+ connection cache and thus we must disconnect it here.
*/
- if(data->set.reuse_forbid || conn->bits.close || premature) {
+ if(data->set.reuse_forbid || conn->bits.close || premature ||
+ (-1 == conn->connectindex)) {
CURLcode res2 = Curl_disconnect(conn); /* close the connection */
/* If we had an error already, make sure we return that one. But