Skip to content

Commit

Permalink
quic: return 0 from SSL_CTX_sess_set_new_cb callback
Browse files Browse the repository at this point in the history
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>
  • Loading branch information
addaleax authored and jasnell committed Jun 22, 2020
1 parent a041723 commit 0e7c8bd
Showing 1 changed file with 1 addition and 1 deletion.
2 changes: 1 addition & 1 deletion src/quic/node_quic_session.cc
Original file line number Diff line number Diff line change
Expand Up @@ -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.
Expand Down

0 comments on commit 0e7c8bd

Please sign in to comment.