diff --git a/src/tls_wrap.cc b/src/tls_wrap.cc index a42e5faa70d8ae..e3dc1e18853d5e 100644 --- a/src/tls_wrap.cc +++ b/src/tls_wrap.cc @@ -305,6 +305,7 @@ void TLSWrap::EncOut() { for (size_t i = 0; i < count; i++) buf[i] = uv_buf_init(data[i], size[i]); int r = stream_->DoWrite(write_req, buf, count, nullptr); + write_req->Dispatched(); // Ignore errors, this should be already handled in js if (!r) @@ -314,6 +315,8 @@ void TLSWrap::EncOut() { void TLSWrap::EncOutCb(WriteWrap* req_wrap, int status) { TLSWrap* wrap = req_wrap->wrap()->Cast(); + req_wrap->~WriteWrap(); + delete[] reinterpret_cast(req_wrap); // Handle error if (status) {