curl/schannel-on-connection-close-there-might-not-be-a-tr.patch

49 lines
1.6 KiB
Diff
Raw Normal View History

2019-09-30 10:36:29 -04:00
From 6ee672970972a40603d8141293ca91c4d4854187 Mon Sep 17 00:00:00 2001
From: Daniel Stenberg <daniel@haxx.se>
Date: Fri, 18 Jan 2019 11:21:25 +0100
Subject: [PATCH 457/557] schannel: on connection close there might not be a
transfer
Reported-by: Marcel Raad
Fixes #3412
Closes #3483
---
lib/vtls/schannel.c | 13 ++++++++++---
1 file changed, 10 insertions(+), 3 deletions(-)
diff --git a/lib/vtls/schannel.c b/lib/vtls/schannel.c
index 56fd93e..ab7f83f 100644
--- a/lib/vtls/schannel.c
+++ b/lib/vtls/schannel.c
@@ -7,7 +7,7 @@
*
* Copyright (C) 2012 - 2016, Marc Hoersken, <info@marc-hoersken.de>
* Copyright (C) 2012, Mark Salisbury, <mark.salisbury@hp.com>
- * Copyright (C) 2012 - 2018, Daniel Stenberg, <daniel@haxx.se>, et al.
+ * Copyright (C) 2012 - 2019, Daniel Stenberg, <daniel@haxx.se>, et al.
*
* This software is licensed as described in the file COPYING, which
* you should have received as part of this distribution. The terms
@@ -2013,9 +2013,16 @@ static int Curl_schannel_shutdown(struct connectdata *conn, int sockindex)
/* free SSPI Schannel API credential handle */
if(BACKEND->cred) {
- Curl_ssl_sessionid_lock(conn);
+ /*
+ * When this function is called from Curl_schannel_close() the connection
+ * might not have an associated transfer so the check for conn->data is
+ * necessary.
+ */
+ if(conn->data)
+ Curl_ssl_sessionid_lock(conn);
Curl_schannel_session_free(BACKEND->cred);
- Curl_ssl_sessionid_unlock(conn);
+ if(conn->data)
+ Curl_ssl_sessionid_unlock(conn);
BACKEND->cred = NULL;
}
--
1.8.3.1