tls: destroy trace BIO instead of leaking it

Fixes: https://github.com/nodejs/node/issues/27636#issuecomment-491343214

PR-URL: https://github.com/nodejs/node/pull/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>
This commit is contained in:
Sam Roberts 2019-05-22 21:07:07 -07:00 committed by Anna Henningsen
parent dd6481a183
commit 725a66a2f0
No known key found for this signature in database
GPG Key ID: 9C63F3A6CD2AD8F9
2 changed files with 4 additions and 2 deletions

View File

@ -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
}

View File

@ -193,6 +193,8 @@ class TLSWrap : public AsyncWrap,
private:
static void GetWriteQueueSize(
const v8::FunctionCallbackInfo<v8::Value>& info);
crypto::BIOPointer bio_trace_;
};
} // namespace node