Skip to content

Commit 0e7c8bd

Browse files
addaleaxjasnell
authored andcommitted
quic: return 0 from SSL_CTX_sess_set_new_cb callback
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: #33931 Reviewed-By: James M Snell <jasnell@gmail.com> Reviewed-By: Daniel Bevenius <daniel.bevenius@gmail.com> Reviewed-By: Tobias Nießen <tniessen@tnie.de>
1 parent a041723 commit 0e7c8bd

File tree

1 file changed

+1
-1
lines changed

1 file changed

+1
-1
lines changed

src/quic/node_quic_session.cc

+1-1
Original file line numberDiff line numberDiff line change
@@ -2295,7 +2295,7 @@ int QuicSession::set_session(SSL_SESSION* session) {
22952295
if (size > SecureContext::kMaxSessionSize)
22962296
return 0;
22972297
listener_->OnSessionTicket(size, session);
2298-
return 1;
2298+
return 0;
22992299
}
23002300

23012301
// A client QuicSession can be migrated to a different QuicSocket instance.

0 commit comments

Comments
 (0)