Skip to content

crypto: make malloc failure check cross-platform #8352

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

Closed
wants to merge 1 commit into from
Closed
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 1 addition & 1 deletion src/node_crypto.cc
Original file line number Diff line number Diff line change
Expand Up @@ -5368,7 +5368,7 @@ class RandomBytesRequest : public AsyncWrap {
error_(0),
size_(size),
data_(static_cast<char*>(malloc(size))) {
if (data() == nullptr)
if (data() == nullptr && size > 0)
FatalError("node::RandomBytesRequest()", "Out of Memory");
Wrap(object, this);
}
Expand Down
5 changes: 0 additions & 5 deletions test/parallel/parallel.status
Original file line number Diff line number Diff line change
Expand Up @@ -27,11 +27,6 @@ test-debug-signal-cluster : PASS,FLAKY
test-fs-watch-enoent : FAIL, PASS
test-fs-watch-encoding : FAIL, PASS

# being worked under https://github.com/nodejs/node/pull/7564
test-async-wrap-post-did-throw : PASS, FLAKY
test-async-wrap-throw-from-callback : PASS, FLAKY
test-crypto-random : PASS, FLAKY

#being worked under https://github.com/nodejs/node/issues/7973
test-stdio-closed : PASS, FLAKY

Expand Down