Skip to content

Commit e8fa067

Browse files
sam-githubtargos
authored andcommitted
tls: destroy trace BIO instead of leaking it
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>
1 parent 85f505c commit e8fa067

File tree

2 files changed

+4
-2
lines changed

2 files changed

+4
-2
lines changed

src/tls_wrap.cc

Lines changed: 2 additions & 2 deletions
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

Lines changed: 2 additions & 0 deletions
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)