diff options
author | Daniel Stenberg <daniel@haxx.se> | 2019-10-28 09:28:05 +0100 |
---|---|---|
committer | Daniel Stenberg <daniel@haxx.se> | 2019-10-30 09:36:21 +0100 |
commit | dcd7e37c3a0ce108635b89cacc1e3425e57bd3bc (patch) | |
tree | 97213435d44104e4217159001944504ce518158d /lib/http2.c | |
parent | 4011802b35638e311e548e8893fa74373275145a (diff) | |
download | curl-dcd7e37c3a0ce108635b89cacc1e3425e57bd3bc.tar.gz |
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
Diffstat (limited to 'lib/http2.c')
-rw-r--r-- | lib/http2.c | 12 |
1 files changed, 5 insertions, 7 deletions
diff --git a/lib/http2.c b/lib/http2.c index bae938811..6315fc401 100644 --- a/lib/http2.c +++ b/lib/http2.c @@ -496,16 +496,14 @@ static struct Curl_easy *duphandle(struct Curl_easy *data) /* setup the request struct */ struct HTTP *http = calloc(1, sizeof(struct HTTP)); if(!http) { - (void)Curl_close(second); - second = NULL; + (void)Curl_close(&second); } else { second->req.protop = http; http->header_recvbuf = Curl_add_buffer_init(); if(!http->header_recvbuf) { free(http); - (void)Curl_close(second); - second = NULL; + (void)Curl_close(&second); } else { Curl_http2_setup_req(second); @@ -547,7 +545,7 @@ static int push_promise(struct Curl_easy *data, stream = data->req.protop; if(!stream) { failf(data, "Internal NULL stream!\n"); - (void)Curl_close(newhandle); + (void)Curl_close(&newhandle); rv = 1; goto fail; } @@ -569,7 +567,7 @@ static int push_promise(struct Curl_easy *data, /* denied, kill off the new handle again */ http2_stream_free(newhandle->req.protop); newhandle->req.protop = NULL; - (void)Curl_close(newhandle); + (void)Curl_close(&newhandle); goto fail; } @@ -585,7 +583,7 @@ static int push_promise(struct Curl_easy *data, infof(data, "failed to add handle to multi\n"); http2_stream_free(newhandle->req.protop); newhandle->req.protop = NULL; - Curl_close(newhandle); + Curl_close(&newhandle); rv = 1; goto fail; } |