diff options
author | Daniel Stenberg <daniel@haxx.se> | 2023-04-15 21:11:36 +0200 |
---|---|---|
committer | Daniel Stenberg <daniel@haxx.se> | 2023-04-15 23:30:05 +0200 |
commit | 81b2b577df40262716ff0e1c0e1cebabb99f012d (patch) | |
tree | cbfb34fef0da9b84ca869231921da3dbb81af65a /lib/multi.c | |
parent | b32b7bb37a97976233327ddac3dd5a67cfef66c6 (diff) | |
download | curl-81b2b577df40262716ff0e1c0e1cebabb99f012d.tar.gz |
multi: free up more data earleier in DONE
Before checking for more users of the connection and possibly bailing
out.
Fixes #10971
Reported-by: Paweł Wegner
Closes #10972
Diffstat (limited to 'lib/multi.c')
-rw-r--r-- | lib/multi.c | 17 |
1 files changed, 9 insertions, 8 deletions
diff --git a/lib/multi.c b/lib/multi.c index b2b1d65a3..0be8d0c40 100644 --- a/lib/multi.c +++ b/lib/multi.c @@ -699,6 +699,15 @@ static CURLcode multi_done(struct Curl_easy *data, process_pending_handles(data->multi); /* connection / multiplex */ + Curl_safefree(data->state.ulbuf); + + /* if the transfer was completed in a paused state there can be buffered + data left to free */ + for(i = 0; i < data->state.tempcount; i++) { + Curl_dyn_free(&data->state.tempwrite[i].b); + } + data->state.tempcount = 0; + CONNCACHE_LOCK(data); Curl_detach_connection(data); if(CONN_INUSE(conn)) { @@ -717,14 +726,6 @@ static CURLcode multi_done(struct Curl_easy *data, conn->dns_entry = NULL; } Curl_hostcache_prune(data); - Curl_safefree(data->state.ulbuf); - - /* if the transfer was completed in a paused state there can be buffered - data left to free */ - for(i = 0; i < data->state.tempcount; i++) { - Curl_dyn_free(&data->state.tempwrite[i].b); - } - data->state.tempcount = 0; /* if data->set.reuse_forbid is TRUE, it means the libcurl client has forced us to close this connection. This is ignored for requests taking |