aboutsummaryrefslogtreecommitdiff
path: root/src/tls_wrap.cc
diff options
context:
space:
mode:
authorFedor Indutny <fedor@indutny.com>2015-03-13 21:40:48 -0700
committerFedor Indutny <fedor@indutny.com>2015-03-14 09:27:52 -0700
commite90ed790c340af01b0b9daa7dec6ff52caccde77 (patch)
treef835fe3a30dd2130758224b7995b36df7cfa11e7 /src/tls_wrap.cc
parent056ed4b0c9753318ce8f5a88659467579acb3faf (diff)
downloadandroid-node-v8-e90ed790c340af01b0b9daa7dec6ff52caccde77.tar.gz
android-node-v8-e90ed790c340af01b0b9daa7dec6ff52caccde77.tar.bz2
android-node-v8-e90ed790c340af01b0b9daa7dec6ff52caccde77.zip
tls: fix leak on `DoWrite()` errors
It is very unlikely to happen, but still the write request should be disposed in case of immediate failure. PR-URL: https://github.com/iojs/io.js/pull/1154 Reviewed-By: Ben Noordhuis <info@bnoordhuis.nl>
Diffstat (limited to 'src/tls_wrap.cc')
-rw-r--r--src/tls_wrap.cc6
1 files changed, 4 insertions, 2 deletions
diff --git a/src/tls_wrap.cc b/src/tls_wrap.cc
index 49523bc3b8..0fab952a2b 100644
--- a/src/tls_wrap.cc
+++ b/src/tls_wrap.cc
@@ -306,11 +306,13 @@ void TLSWrap::EncOut() {
uv_buf_t buf[ARRAY_SIZE(data)];
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);
+ int err = stream_->DoWrite(write_req, buf, count, nullptr);
write_req->Dispatched();
// Ignore errors, this should be already handled in js
- if (!r)
+ if (err)
+ write_req->Dispose();
+ else
NODE_COUNT_NET_BYTES_SENT(write_size_);
}