aboutsummaryrefslogtreecommitdiff
path: root/lib
diff options
context:
space:
mode:
authorDaniel Stenberg <daniel@haxx.se>2009-10-18 00:10:13 +0000
committerDaniel Stenberg <daniel@haxx.se>2009-10-18 00:10:13 +0000
commit167a92810a77b3abd973ea987a1306cfa155d65c (patch)
tree16b52689d01583e738ddc37cb55c7bce83d813d5 /lib
parentb8b8c3d5383d2a56065e6880fb267ed6df737b00 (diff)
- Kevin Baughman found a double close() problem with libcurl-NSS, as when
libcurl called NSS to close the SSL "session" it also closed the actual socket.
Diffstat (limited to 'lib')
-rw-r--r--lib/nss.c8
1 files changed, 6 insertions, 2 deletions
diff --git a/lib/nss.c b/lib/nss.c
index abc1a4c31..866b1d0c8 100644
--- a/lib/nss.c
+++ b/lib/nss.c
@@ -927,11 +927,15 @@ void Curl_nss_close(struct connectdata *conn, int sockindex)
if(connssl->handle) {
PR_Close(connssl->handle);
+
+ /* NSS closes the socket we previously handed to it, so we must mark it
+ as closed to avoid double close */
+ conn->sock[sockindex] = CURL_SOCKET_BAD;
if(connssl->client_nickname != NULL) {
free(connssl->client_nickname);
connssl->client_nickname = NULL;
}
-#ifdef HAVE_PK11_CREATEGENERICOBJECT
+#ifdef HAVE_PK11_CREATEGENERICOBJECT
if(connssl->key)
(void)PK11_DestroyGenericObject(connssl->key);
if(connssl->cacert[1])
@@ -973,7 +977,7 @@ CURLcode Curl_nss_connect(struct connectdata *conn, int sockindex)
connssl->data = data;
-#ifdef HAVE_PK11_CREATEGENERICOBJECT
+#ifdef HAVE_PK11_CREATEGENERICOBJECT
connssl->cacert[0] = NULL;
connssl->cacert[1] = NULL;
connssl->key = NULL;