summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorDaniel Stenberg <daniel@haxx.se>2019-10-27 22:20:02 +0100
committerDaniel Stenberg <daniel@haxx.se>2019-10-29 22:48:19 +0100
commit0cbd6f8df72cb425e431312d91250d86df83b60b (patch)
treecf4604a2a05f789f1c1b74c6074058232d6d454c
parent32cc5ca7ad328e4b007c113b8028a57f9cef4ac0 (diff)
downloadcurl-0cbd6f8df72cb425e431312d91250d86df83b60b.tar.gz
url: Curl_free_request_state() should also free doh handles
... or risk DoH memory leaks. Reported-by: Paul Dreik Fixes #4463 Closes #4527
-rw-r--r--lib/url.c7
1 files changed, 4 insertions, 3 deletions
diff --git a/lib/url.c b/lib/url.c
index 660d24141..bbae273fd 100644
--- a/lib/url.c
+++ b/lib/url.c
@@ -399,9 +399,6 @@ CURLcode Curl_close(struct Curl_easy *data)
Curl_share_unlock(data, CURL_LOCK_DATA_SHARE);
}
- /* Leave no dangling DOH handles behind */
- Curl_close(data->req.doh.probe[0].easy);
- Curl_close(data->req.doh.probe[1].easy);
free(data->req.doh.probe[0].serverdoh.memory);
free(data->req.doh.probe[1].serverdoh.memory);
curl_slist_free_all(data->req.doh.headers);
@@ -1986,6 +1983,10 @@ void Curl_free_request_state(struct Curl_easy *data)
{
Curl_safefree(data->req.protop);
Curl_safefree(data->req.newurl);
+ Curl_close(data->req.doh.probe[0].easy);
+ data->req.doh.probe[0].easy = NULL;
+ Curl_close(data->req.doh.probe[1].easy);
+ data->req.doh.probe[1].easy = NULL;
}