Repository: trafficserver
Updated Branches:
  refs/heads/ts3714 8c76e6aca -> 2f41a41e9


[TS-3714]: Fix ssl's first byte iobuf leak in error cases


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

Branch: refs/heads/ts3714
Commit: 2f41a41e92e8d85c7c581664fdc587d1d8860f95
Parents: 8c76e6a
Author: Sudheer Vinukonda <[email protected]>
Authored: Tue Jun 30 05:24:03 2015 +0000
Committer: Sudheer Vinukonda <[email protected]>
Committed: Tue Jun 30 05:24:03 2015 +0000

----------------------------------------------------------------------
 iocore/net/P_SSLNetVConnection.h | 6 ++++++
 iocore/net/SSLNetVConnection.cc  | 3 +++
 proxy/http/HttpClientSession.cc  | 5 +++++
 3 files changed, 14 insertions(+)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/trafficserver/blob/2f41a41e/iocore/net/P_SSLNetVConnection.h
----------------------------------------------------------------------
diff --git a/iocore/net/P_SSLNetVConnection.h b/iocore/net/P_SSLNetVConnection.h
index 51748cf..d4a4792 100644
--- a/iocore/net/P_SSLNetVConnection.h
+++ b/iocore/net/P_SSLNetVConnection.h
@@ -225,6 +225,12 @@ public:
     return iobuf;
   }
 
+  void
+  set_ssl_iobuf(MIOBuffer* buf)
+  {
+    iobuf = buf;
+  }
+
   IOBufferReader*
   get_ssl_reader()
   {

http://git-wip-us.apache.org/repos/asf/trafficserver/blob/2f41a41e/iocore/net/SSLNetVConnection.cc
----------------------------------------------------------------------
diff --git a/iocore/net/SSLNetVConnection.cc b/iocore/net/SSLNetVConnection.cc
index 64c6d6e..0e9272c 100644
--- a/iocore/net/SSLNetVConnection.cc
+++ b/iocore/net/SSLNetVConnection.cc
@@ -860,6 +860,9 @@ SSLNetVConnection::free(EThread *t)
     SSL_free(ssl);
     ssl = NULL;
   }
+  if (iobuf) {
+    free_MIOBuffer(iobuf);
+  }
   sslHandShakeComplete = false;
   sslClientConnection = false;
   sslHandshakeBeginTime = 0;

http://git-wip-us.apache.org/repos/asf/trafficserver/blob/2f41a41e/proxy/http/HttpClientSession.cc
----------------------------------------------------------------------
diff --git a/proxy/http/HttpClientSession.cc b/proxy/http/HttpClientSession.cc
index 385da26..fe78143 100644
--- a/proxy/http/HttpClientSession.cc
+++ b/proxy/http/HttpClientSession.cc
@@ -308,6 +308,11 @@ HttpClientSession::do_io_close(int alerrno)
     
client_vc->set_active_timeout(HRTIME_SECONDS(current_reader->t_state.txn_conf->keep_alive_no_activity_timeout_out));
   } else {
     read_state = HCS_CLOSED;
+    // clean up ssl's first byte iobuf
+    SSLNetVConnection *ssl_vc = dynamic_cast<SSLNetVConnection *>(client_vc);
+    if (ssl_vc) {
+      ssl_vc->set_ssl_iobuf(NULL);
+    }
     if (upgrade_to_h2c) {
       Http2ClientSession *h2_session = http2ClientSessionAllocator.alloc();
 

Reply via email to