conncache: find bundle again in case it is removed

When the pool is cleaned up due to host limits, the bundle may be
cleaned up as well making the old pointer invalid.

Fixes #15185
Reported-by: Moritz Knüsel
Closes #15186
This commit is contained in:
Daniel Stenberg 2024-10-08 08:00:55 +02:00
parent 80dac51af8
commit 699a2df350
No known key found for this signature in database
GPG Key ID: 5CC908FDB71E12C2

View File

@ -329,6 +329,9 @@ int Curl_cpool_check_limits(struct Curl_easy *data,
"limit of %zu", oldest_idle->connection_id,
Curl_llist_count(&bundle->conns), dest_limit));
Curl_cpool_disconnect(data, oldest_idle, FALSE);
/* in case the bundle was destroyed in disconnect, look it up again */
bundle = cpool_find_bundle(cpool, conn);
}
if(bundle && (Curl_llist_count(&bundle->conns) >= dest_limit)) {
result = CPOOL_LIMIT_DEST;