Skip to content

Commit

Permalink
tls: destroy trace BIO instead of leaking it
Browse files Browse the repository at this point in the history
Fixes: #27636 (comment)

PR-URL: #27834
Reviewed-By: James M Snell <jasnell@gmail.com>
Reviewed-By: Ben Noordhuis <info@bnoordhuis.nl>
Reviewed-By: Anna Henningsen <anna@addaleax.net>
Reviewed-By: Colin Ihrig <cjihrig@gmail.com>
Reviewed-By: Rich Trott <rtrott@gmail.com>
  • Loading branch information
sam-github authored and addaleax committed May 26, 2019
1 parent dd6481a commit 725a66a
Show file tree
Hide file tree
Showing 2 changed files with 4 additions and 2 deletions.
4 changes: 2 additions & 2 deletions src/tls_wrap.cc
Original file line number Diff line number Diff line change
Expand Up @@ -939,9 +939,9 @@ void TLSWrap::EnableTrace(

#if HAVE_SSL_TRACE
if (wrap->ssl_) {
BIO* b = BIO_new_fp(stderr, BIO_NOCLOSE | BIO_FP_TEXT);
wrap->bio_trace_.reset(BIO_new_fp(stderr, BIO_NOCLOSE | BIO_FP_TEXT));
SSL_set_msg_callback(wrap->ssl_.get(), SSL_trace);
SSL_set_msg_callback_arg(wrap->ssl_.get(), b);
SSL_set_msg_callback_arg(wrap->ssl_.get(), wrap->bio_trace_.get());
}
#endif
}
Expand Down
2 changes: 2 additions & 0 deletions src/tls_wrap.h
Original file line number Diff line number Diff line change
Expand Up @@ -193,6 +193,8 @@ class TLSWrap : public AsyncWrap,
private:
static void GetWriteQueueSize(
const v8::FunctionCallbackInfo<v8::Value>& info);

crypto::BIOPointer bio_trace_;
};

} // namespace node
Expand Down

0 comments on commit 725a66a

Please sign in to comment.