Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

tls: fix leak on DoWrite() errors #1154

Closed
wants to merge 1 commit into from

Conversation

indutny
Copy link
Member

@indutny indutny commented Mar 14, 2015

It is very unlikely to happen, but still the write request should be
disposed in case of immediate failure.

cc @iojs/crypto @bnoordhuis

It is very unlikely to happen, but still the write request should be
disposed in case of immediate failure.
@@ -310,8 +310,10 @@ void TLSWrap::EncOut() {
write_req->Dispatched();
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Can I suggest that for consistency you write it as follows?

const int err = stream_->DoWrite(write_req, buf, count, nullptr);
write_req->Dispatched();
if (err < 0)
  write_req->Dispose();

Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Gosh, I just realized that the condition was wrong here :)

@bnoordhuis
Copy link
Member

LGTM with a suggestion.

indutny added a commit that referenced this pull request Mar 14, 2015
It is very unlikely to happen, but still the write request should be
disposed in case of immediate failure.

PR-URL: #1154
Reviewed-By: Ben Noordhuis <info@bnoordhuis.nl>
@indutny
Copy link
Member Author

indutny commented Mar 14, 2015

Landed in e90ed79, thank you! I have used if (err), because this is what we was doing in stream_wrap/stream_base.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

None yet

2 participants