]> git.ipfire.org Git - thirdparty/squid.git/commitdiff
BUGFIX: Plug a large SSL memory leak. SSL connections was never freed.
authorhno <>
Mon, 27 Aug 2001 04:22:43 +0000 (04:22 +0000)
committerhno <>
Mon, 27 Aug 2001 04:22:43 +0000 (04:22 +0000)
Note: This is done in a quite crude manner, and there most likely is
better ways of doing this. Have investigated the use of a close handler
but it won't fit well with lingering closes.

src/comm.cc

index 0f53210da5501c01938bc86d522c7c451a494ffc..b6717fddf2f0a6f76f701980cbbf511dbd46d1d7 100644 (file)
@@ -1,6 +1,6 @@
 
 /*
- * $Id: comm.cc,v 1.319 2001/08/16 00:16:16 hno Exp $
+ * $Id: comm.cc,v 1.320 2001/08/26 22:22:43 hno Exp $
  *
  * DEBUG: section 5     Socket Functions
  * AUTHOR: Harvest Derived
@@ -559,6 +559,10 @@ commLingerTimeout(int fd, void *unused)
 void
 comm_lingering_close(int fd)
 {
+#if USE_SSL
+    if (fd_table[fd].ssl)
+       SSL_shutdown(fd_table[fd].ssl);
+#endif
     if (shutdown(fd, 1) < 0) {
        comm_close(fd);
        return;
@@ -586,10 +590,20 @@ comm_close(int fd)
     assert(F->flags.open);
     assert(F->type != FD_FILE);
     F->flags.closing = 1;
+#if USE_SSL
+    if (F->ssl)
+       SSL_shutdown(F->ssl);
+#endif
     CommWriteStateCallbackAndFree(fd, COMM_ERR_CLOSING);
     commCallCloseHandlers(fd);
     if (F->uses)               /* assume persistent connect count */
        pconnHistCount(1, F->uses);
+#if USE_SSL
+    if (F->ssl) {
+       SSL_free(F->ssl);
+       F->ssl = NULL;
+    }
+#endif
     fd_close(fd);              /* update fdstat */
     close(fd);
     statCounter.syscalls.sock.closes++;