From: Daniel Lehman Subject: [PATCH v2] wininet: Free security context in failure case. Message-Id: <20181129071017.25665-1-dlehman25@gmail.com> Date: Wed, 28 Nov 2018 23:10:17 -0800 Signed-off-by: Daniel Lehman --- v2: invalidate handle after free --- dlls/wininet/netconnection.c | 4 ++++ 1 file changed, 4 insertions(+) diff --git a/dlls/wininet/netconnection.c b/dlls/wininet/netconnection.c index 4ad22177ee..c8bb3973e7 100644 --- a/dlls/wininet/netconnection.c +++ b/dlls/wininet/netconnection.c @@ -573,6 +573,10 @@ static DWORD netcon_secure_connect_setup(netconn_t *connection, BOOL compat_mode WARN("Failed to establish SSL connection: %08x (%u)\n", status, res); heap_free(connection->ssl_buf); connection->ssl_buf = NULL; + if(SecIsValidHandle(&connection->ssl_ctx)) { + DeleteSecurityContext(&connection->ssl_ctx); + SecInvalidateHandle(&connection->ssl_ctx); + } return res ? res : ERROR_INTERNET_SECURITY_CHANNEL_ERROR; } -- 2.17.1