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:
Родитель
e763220f66
Коммит
7f4c95e160
|
@ -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<TLSWrap>();
|
||||
req_wrap->~WriteWrap();
|
||||
delete[] reinterpret_cast<char*>(req_wrap);
|
||||
|
||||
// Handle error
|
||||
if (status) {
|
||||
|
|
Загрузка…
Ссылка в новой задаче