diff options
author | Gisle Vanem <gisle.vanem@gmail.com> | 2021-10-19 12:56:15 +0200 |
---|---|---|
committer | GitHub <noreply@github.com> | 2021-10-19 12:56:15 +0200 |
commit | 31e335b3ed63494e3a92d98154fd2bb5fdfc6d76 (patch) | |
tree | 1952d2dce34bcc3a6a8418a0721546ea86f51a34 | |
parent | 275e5431333c5d09f9445ba407d5c8bdd8027957 (diff) | |
download | curl-31e335b3ed63494e3a92d98154fd2bb5fdfc6d76.tar.gz |
SChannel: plug mem-leaks
Plug some memory leaks on a failed `InitializeSecurityContext()`.
-rw-r--r-- | lib/vtls/schannel.c | 9 |
1 files changed, 7 insertions, 2 deletions
diff --git a/lib/vtls/schannel.c b/lib/vtls/schannel.c index ef3c919bb..62a4cd17a 100644 --- a/lib/vtls/schannel.c +++ b/lib/vtls/schannel.c @@ -152,6 +152,9 @@ static Curl_recv schannel_recv; static Curl_send schannel_send; +static int schannel_shutdown(struct Curl_easy *data, struct connectdata *conn, + int sockindex); + static CURLcode pkp_pin_peer_pubkey(struct Curl_easy *data, struct connectdata *conn, int sockindex, const char *pinnedpubkey); @@ -1141,7 +1144,7 @@ schannel_connect_step2(struct Curl_easy *data, struct connectdata *conn, if(!host_name) return CURLE_OUT_OF_MEMORY; - /* https://msdn.microsoft.com/en-us/library/windows/desktop/aa375924.aspx + /* https://docs.microsoft.com/en-us/windows/win32/api/sspi/nf-sspi-initializesecuritycontexta */ sspi_status = s_pSecFn->InitializeSecurityContext( &BACKEND->cred->cred_handle, &BACKEND->ctxt->ctxt_handle, @@ -2128,9 +2131,11 @@ static bool schannel_data_pending(const struct connectdata *conn, static void schannel_close(struct Curl_easy *data, struct connectdata *conn, int sockindex) { - if(conn->ssl[sockindex].use) + if(conn->ssl[sockindex].use) { /* if the SSL/TLS channel hasn't been shut down yet, do that now. */ Curl_ssl_shutdown(data, conn, sockindex); + } + schannel_shutdown(data, conn, sockindex); } static void schannel_session_free(void *ptr) |