1
0
mirror of https://github.com/moparisthebest/curl synced 2024-11-04 08:35:05 -05:00

url: Curl_free_request_state() should also free doh handles

... or risk DoH memory leaks.

Reported-by: Paul Dreik
Fixes #4463
Closes #4527
This commit is contained in:
Daniel Stenberg 2019-10-27 22:20:02 +01:00
parent 32cc5ca7ad
commit 0cbd6f8df7
No known key found for this signature in database
GPG Key ID: 5CC908FDB71E12C2

View File

@ -399,9 +399,6 @@ CURLcode Curl_close(struct Curl_easy *data)
Curl_share_unlock(data, CURL_LOCK_DATA_SHARE); 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[0].serverdoh.memory);
free(data->req.doh.probe[1].serverdoh.memory); free(data->req.doh.probe[1].serverdoh.memory);
curl_slist_free_all(data->req.doh.headers); 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.protop);
Curl_safefree(data->req.newurl); 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;
} }