diff options
author | Daniel Stenberg <daniel@haxx.se> | 2021-01-19 15:57:24 +0100 |
---|---|---|
committer | Daniel Stenberg <daniel@haxx.se> | 2021-01-20 09:02:24 +0100 |
commit | 6246a1d8c6776a60f266f1906f0ef9048e9e1069 (patch) | |
tree | 2773ae0bf184bc357b07c2c8a381f1680f41871b /lib/url.c | |
parent | d0688dcbdf412273e276dd29135b952f2065cb5b (diff) | |
download | curl-6246a1d8c6776a60f266f1906f0ef9048e9e1069.tar.gz |
doh: allocate state struct on demand
... instead of having it static within the Curl_easy struct. This takes
away 1176 bytes (18%) from the Curl_easy struct that aren't used very
often and instead makes the code allocate it when needed.
Closes #6492
Diffstat (limited to 'lib/url.c')
-rw-r--r-- | lib/url.c | 15 |
1 files changed, 10 insertions, 5 deletions
@@ -451,9 +451,12 @@ CURLcode Curl_close(struct Curl_easy **datap) Curl_safefree(data->state.aptr.rtsp_transport); #ifndef CURL_DISABLE_DOH - Curl_dyn_free(&data->req.doh.probe[0].serverdoh); - Curl_dyn_free(&data->req.doh.probe[1].serverdoh); - curl_slist_free_all(data->req.doh.headers); + if(data->req.doh) { + Curl_dyn_free(&data->req.doh->probe[0].serverdoh); + Curl_dyn_free(&data->req.doh->probe[1].serverdoh); + curl_slist_free_all(data->req.doh->headers); + Curl_safefree(data->req.doh); + } #endif /* destruct wildcard structures if it is needed */ @@ -2138,8 +2141,10 @@ void Curl_free_request_state(struct Curl_easy *data) Curl_safefree(data->req.newurl); #ifndef CURL_DISABLE_DOH - Curl_close(&data->req.doh.probe[0].easy); - Curl_close(&data->req.doh.probe[1].easy); + if(data->req.doh) { + Curl_close(&data->req.doh->probe[0].easy); + Curl_close(&data->req.doh->probe[1].easy); + } #endif } |