tls: do not leak WriteWrap objects
Kill WriteWrap instances that are allocated in `tls_wrap.cc` internally. Fix: https://github.com/iojs/io.js/issues/1075 PR-URL: https://github.com/iojs/io.js/pull/1090 Reviewed-By: Ben Noordhuis <info@bnoordhuis.nl>
This commit is contained in:
parent
e763220f66
commit
7f4c95e160
@ -305,6 +305,7 @@ void TLSWrap::EncOut() {
|
|||||||
for (size_t i = 0; i < count; i++)
|
for (size_t i = 0; i < count; i++)
|
||||||
buf[i] = uv_buf_init(data[i], size[i]);
|
buf[i] = uv_buf_init(data[i], size[i]);
|
||||||
int r = stream_->DoWrite(write_req, buf, count, nullptr);
|
int r = stream_->DoWrite(write_req, buf, count, nullptr);
|
||||||
|
write_req->Dispatched();
|
||||||
|
|
||||||
// Ignore errors, this should be already handled in js
|
// Ignore errors, this should be already handled in js
|
||||||
if (!r)
|
if (!r)
|
||||||
@ -314,6 +315,8 @@ void TLSWrap::EncOut() {
|
|||||||
|
|
||||||
void TLSWrap::EncOutCb(WriteWrap* req_wrap, int status) {
|
void TLSWrap::EncOutCb(WriteWrap* req_wrap, int status) {
|
||||||
TLSWrap* wrap = req_wrap->wrap()->Cast<TLSWrap>();
|
TLSWrap* wrap = req_wrap->wrap()->Cast<TLSWrap>();
|
||||||
|
req_wrap->~WriteWrap();
|
||||||
|
delete[] reinterpret_cast<char*>(req_wrap);
|
||||||
|
|
||||||
// Handle error
|
// Handle error
|
||||||
if (status) {
|
if (status) {
|
||||||
|
Loading…
x
Reference in New Issue
Block a user