Skip to content

Commit 725a66a

Browse files
sam-githubaddaleax
authored andcommitted
tls: destroy trace BIO instead of leaking it
Fixes: #27636 (comment) PR-URL: #27834 Reviewed-By: James M Snell <[email protected]> Reviewed-By: Ben Noordhuis <[email protected]> Reviewed-By: Anna Henningsen <[email protected]> Reviewed-By: Colin Ihrig <[email protected]> Reviewed-By: Rich Trott <[email protected]>
1 parent dd6481a commit 725a66a

File tree

2 files changed

+4
-2
lines changed

2 files changed

+4
-2
lines changed

src/tls_wrap.cc

+2-2
Original file line numberDiff line numberDiff line change
@@ -939,9 +939,9 @@ void TLSWrap::EnableTrace(
939939

940940
#if HAVE_SSL_TRACE
941941
if (wrap->ssl_) {
942-
BIO* b = BIO_new_fp(stderr, BIO_NOCLOSE | BIO_FP_TEXT);
942+
wrap->bio_trace_.reset(BIO_new_fp(stderr, BIO_NOCLOSE | BIO_FP_TEXT));
943943
SSL_set_msg_callback(wrap->ssl_.get(), SSL_trace);
944-
SSL_set_msg_callback_arg(wrap->ssl_.get(), b);
944+
SSL_set_msg_callback_arg(wrap->ssl_.get(), wrap->bio_trace_.get());
945945
}
946946
#endif
947947
}

src/tls_wrap.h

+2
Original file line numberDiff line numberDiff line change
@@ -193,6 +193,8 @@ class TLSWrap : public AsyncWrap,
193193
private:
194194
static void GetWriteQueueSize(
195195
const v8::FunctionCallbackInfo<v8::Value>& info);
196+
197+
crypto::BIOPointer bio_trace_;
196198
};
197199

198200
} // namespace node

0 commit comments

Comments
 (0)