From 792f1106b319e77d5ec927d74ff3d4ca41f4311b Mon Sep 17 00:00:00 2001 From: Anna Henningsen Date: Wed, 17 Jun 2020 20:15:21 +0200 Subject: [PATCH] quic: return 0 from SSL_CTX_sess_set_new_cb callback MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit The callback passed to `SSL_CTX_sess_set_new_cb()` should return 1 if it takes ownership (i.e. holds a reference that is later freed through `SSL_SESSION_free()`) of the passed session, and 0 otherwise. Since we don’t take ownership of the session and instead only save a serialized version of it, return 0 instead of 1. This closes a memory leak reported when running `sequential/test-quic-preferred-address-ipv6`. --- src/quic/node_quic_session.cc | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/quic/node_quic_session.cc b/src/quic/node_quic_session.cc index 66addb3133ab36..bfa4cc51645a1c 100644 --- a/src/quic/node_quic_session.cc +++ b/src/quic/node_quic_session.cc @@ -2295,7 +2295,7 @@ int QuicSession::set_session(SSL_SESSION* session) { if (size > SecureContext::kMaxSessionSize) return 0; listener_->OnSessionTicket(size, session); - return 1; + return 0; } // A client QuicSession can be migrated to a different QuicSocket instance.