Skip to content

tls: fix leak on DoWrite() errors - #1154

Closed
indutny wants to merge 1 commit into
nodejs:v1.xfrom
indutny:fix/unlikely-tls-leak
Closed

tls: fix leak on DoWrite() errors#1154
indutny wants to merge 1 commit into
nodejs:v1.xfrom
indutny:fix/unlikely-tls-leak

Conversation

@indutny

@indutny indutny commented Mar 14, 2015

Copy link
Copy Markdown
Member

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.
Comment thread src/tls_wrap.cc

Copy link
Copy Markdown
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
Copy Markdown
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
Copy Markdown
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

indutny commented Mar 14, 2015

Copy link
Copy Markdown
Member Author

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.

2 participants