mirror of
https://github.com/curl/curl.git
synced 2026-08-25 10:53:37 +03:00
url: make Curl_close() NULLify the pointer too
This is the common pattern used in the code and by a unified approach we avoid mistakes. Closes #4534
This commit is contained in:
parent
4011802b35
commit
dcd7e37c3a
7 changed files with 25 additions and 31 deletions
14
lib/url.c
14
lib/url.c
|
|
@ -317,13 +317,17 @@ static void up_free(struct Curl_easy *data)
|
|||
* when curl_easy_perform() is invoked.
|
||||
*/
|
||||
|
||||
CURLcode Curl_close(struct Curl_easy *data)
|
||||
CURLcode Curl_close(struct Curl_easy **datap)
|
||||
{
|
||||
struct Curl_multi *m;
|
||||
struct Curl_easy *data;
|
||||
|
||||
if(!data)
|
||||
if(!datap || !*datap)
|
||||
return CURLE_OK;
|
||||
|
||||
data = *datap;
|
||||
*datap = NULL;
|
||||
|
||||
Curl_expire_clear(data); /* shut off timers */
|
||||
|
||||
m = data->multi;
|
||||
|
|
@ -1983,10 +1987,8 @@ 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;
|
||||
Curl_close(&data->req.doh.probe[0].easy);
|
||||
Curl_close(&data->req.doh.probe[1].easy);
|
||||
}
|
||||
|
||||
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue