Skip to content

Commit 7f4c95e

Browse files
committed
tls: do not leak WriteWrap objects
Kill WriteWrap instances that are allocated in `tls_wrap.cc` internally. Fix: #1075 PR-URL: #1090 Reviewed-By: Ben Noordhuis <[email protected]>
1 parent e763220 commit 7f4c95e

File tree

1 file changed

+3
-0
lines changed

1 file changed

+3
-0
lines changed

src/tls_wrap.cc

+3
Original file line numberDiff line numberDiff line change
@@ -305,6 +305,7 @@ void TLSWrap::EncOut() {
305305
for (size_t i = 0; i < count; i++)
306306
buf[i] = uv_buf_init(data[i], size[i]);
307307
int r = stream_->DoWrite(write_req, buf, count, nullptr);
308+
write_req->Dispatched();
308309

309310
// Ignore errors, this should be already handled in js
310311
if (!r)
@@ -314,6 +315,8 @@ void TLSWrap::EncOut() {
314315

315316
void TLSWrap::EncOutCb(WriteWrap* req_wrap, int status) {
316317
TLSWrap* wrap = req_wrap->wrap()->Cast<TLSWrap>();
318+
req_wrap->~WriteWrap();
319+
delete[] reinterpret_cast<char*>(req_wrap);
317320

318321
// Handle error
319322
if (status) {

0 commit comments

Comments
 (0)