summaryrefslogtreecommitdiff
path: root/lib/url.c
diff options
context:
space:
mode:
authorDaniel Stenberg <daniel@haxx.se>2019-09-16 16:38:01 +0200
committerDaniel Stenberg <daniel@haxx.se>2019-09-16 17:31:56 +0200
commit9bc44ff64d90812251a1f91020d753f125cd6ab4 (patch)
tree3d7f0e7b26e07413c01054a0b9f1fe72ca497e23 /lib/url.c
parent3ad883aeda4aaccdc5b50ac1afdd8816ce131f07 (diff)
downloadcurl-9bc44ff64d90812251a1f91020d753f125cd6ab4.tar.gz
doh: clean up dangling DOH handles and memory on easy close
If you set the same URL for target as for DoH (and it isn't a DoH server), like "https://example.com" in both, the easy handles used for the DoH requests could be left "dangling" and end up not getting freed. Reported-by: Paul Dreik Closes #4366
Diffstat (limited to 'lib/url.c')
-rw-r--r--lib/url.c6
1 files changed, 6 insertions, 0 deletions
diff --git a/lib/url.c b/lib/url.c
index b7cf7bedd..94dc9b8b2 100644
--- a/lib/url.c
+++ b/lib/url.c
@@ -399,6 +399,12 @@ 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);
+
/* destruct wildcard structures if it is needed */
Curl_wildcard_dtor(&data->wildcard);
Curl_freeset(data);