vschannel: add missing guards against multiple calls to vschannel_cleanup (#10895)

pull/10353/head
JalonSolov 2021-07-21 15:46:51 -04:00 committed by GitHub
parent 41982053f1
commit 4f22ae4a30
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
1 changed files with 2 additions and 0 deletions

View File

@ -60,11 +60,13 @@ void vschannel_cleanup(TlsContext *tls_ctx) {
// Close socket. // Close socket.
if(tls_ctx->socket != INVALID_SOCKET) { if(tls_ctx->socket != INVALID_SOCKET) {
closesocket(tls_ctx->socket); closesocket(tls_ctx->socket);
tls_ctx->socket = INVALID_SOCKET;
} }
// Close "MY" certificate store. // Close "MY" certificate store.
if(tls_ctx->cert_store) { if(tls_ctx->cert_store) {
CertCloseStore(tls_ctx->cert_store, 0); CertCloseStore(tls_ctx->cert_store, 0);
tls_ctx->cert_store = NULL;
} }
} }