Repository: trafficserver
Updated Branches:
  refs/heads/master 0515d2bb5 -> b9599cada


[TS-3261]: Fix SSL BIO memory leak issue introduced in TS-3006


Project: http://git-wip-us.apache.org/repos/asf/trafficserver/repo
Commit: http://git-wip-us.apache.org/repos/asf/trafficserver/commit/d3219505
Tree: http://git-wip-us.apache.org/repos/asf/trafficserver/tree/d3219505
Diff: http://git-wip-us.apache.org/repos/asf/trafficserver/diff/d3219505

Branch: refs/heads/master
Commit: d3219505e46f2bce208aa5ab33b80de3030c5035
Parents: 0515d2b
Author: Sudheer Vinukonda <[email protected]>
Authored: Sat Dec 27 17:05:54 2014 +0000
Committer: Sudheer Vinukonda <[email protected]>
Committed: Sat Dec 27 17:05:54 2014 +0000

----------------------------------------------------------------------
 iocore/net/SSLInternal.cc       | 3 +++
 iocore/net/SSLNetVConnection.cc | 8 ++++++++
 2 files changed, 11 insertions(+)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/trafficserver/blob/d3219505/iocore/net/SSLInternal.cc
----------------------------------------------------------------------
diff --git a/iocore/net/SSLInternal.cc b/iocore/net/SSLInternal.cc
index d2c96fe..16e1be9 100644
--- a/iocore/net/SSLInternal.cc
+++ b/iocore/net/SSLInternal.cc
@@ -32,5 +32,8 @@
 void
 SSL_set_rbio(SSLNetVConnection *sslvc, BIO *rbio)
 {
+  if (sslvc->ssl->rbio != NULL) {
+    BIO_free (sslvc->ssl->rbio);
+  }
   sslvc->ssl->rbio = rbio;
 }

http://git-wip-us.apache.org/repos/asf/trafficserver/blob/d3219505/iocore/net/SSLNetVConnection.cc
----------------------------------------------------------------------
diff --git a/iocore/net/SSLNetVConnection.cc b/iocore/net/SSLNetVConnection.cc
index 1c63002..a40c8a8 100644
--- a/iocore/net/SSLNetVConnection.cc
+++ b/iocore/net/SSLNetVConnection.cc
@@ -143,6 +143,14 @@ make_ssl_connection(SSL_CTX * ctx, SSLNetVConnection * 
netvc)
       BIO *rbio = BIO_new(BIO_s_mem());
       BIO *wbio = BIO_new_fd(netvc->get_socket(), BIO_NOCLOSE);
       BIO_set_mem_eof_return(wbio, -1);
+      BIO* old_rbio = SSL_get_rbio(ssl);
+      BIO* old_wbio = SSL_get_wbio(ssl);
+      if (old_rbio) {
+        BIO_free(old_rbio);
+      }
+      if (old_wbio) {
+        BIO_free(old_wbio);
+      }
       SSL_set_bio(ssl, rbio, wbio);
     }
 

Reply via email to