Skip to content

Navigation Menu

Sign in
Appearance settings

Search code, repositories, users, issues, pull requests...

Provide feedback

We read every piece of feedback, and take your input very seriously.

Saved searches

Use saved searches to filter your results more quickly

Appearance settings

Commit 34f2cfa

Browse filesBrowse files
skomskiFishrock123
authored andcommitted
src: better error message on failed Buffer malloc
PR-URL: #2422 Reviewed-By: Ben Noordhuis <info@bnoordhuis.nl>
1 parent 7fe6dd8 commit 34f2cfa
Copy full SHA for 34f2cfa

File tree

Expand file treeCollapse file tree

1 file changed

+4
-2
lines changed
Open diff view settings
Filter options
Expand file treeCollapse file tree

1 file changed

+4
-2
lines changed
Open diff view settings
Collapse file

‎src/node_buffer.cc‎

Copy file name to clipboardExpand all lines: src/node_buffer.cc
+4-2Lines changed: 4 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -408,8 +408,10 @@ void Create(const FunctionCallbackInfo<Value>& args) {
408408
void* data;
409409
if (length > 0) {
410410
data = malloc(length);
411-
if (data == nullptr)
412-
return env->ThrowRangeError("invalid Buffer length");
411+
if (data == nullptr) {
412+
return env->ThrowRangeError(
413+
"Buffer allocation failed - process out of memory");
414+
}
413415
} else {
414416
data = nullptr;
415417
}

0 commit comments

Comments
0 (0)
Morty Proxy This is a proxified and sanitized view of the page, visit original site.