From dcd7e37c3a0ce108635b89cacc1e3425e57bd3bc Mon Sep 17 00:00:00 2001 From: Daniel Stenberg Date: Mon, 28 Oct 2019 09:28:05 +0100 Subject: 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 --- lib/http2.c | 12 +++++------- 1 file changed, 5 insertions(+), 7 deletions(-) (limited to 'lib/http2.c') 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; } -- cgit v1.2.3