From 0e7c8bdc0c3ae804c09802309adcf00511079e61 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`. PR-URL: https://github.com/nodejs/node/pull/33931 Reviewed-By: James M Snell Reviewed-By: Daniel Bevenius Reviewed-By: Tobias Nießen --- 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 5329c992d11c7c..16a1a623e21957 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.