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 0783ddf

Browse filesBrowse files
kvakildanielleadams
authored andcommitted
buffer: do not leak memory if buffer is too big
A recent pull request changed this method to throw when the buffer was too big, but this meant that the `free` finalizer would never get called, leading to a memory leak. A previous version of this diff included a test provoking this behavior with `v8.serialize`, but it unfortunately kept triggering the OOM killer, so it was removed. Refs: #40243 PR-URL: #43938 Reviewed-By: Darshan Sen <raisinten@gmail.com> Reviewed-By: Tobias Nießen <tniessen@tnie.de> Reviewed-By: Ben Noordhuis <info@bnoordhuis.nl>
1 parent 8850555 commit 0783ddf
Copy full SHA for 0783ddf

File tree

Expand file treeCollapse file tree

1 file changed

+1
-0
lines changed
Open diff view settings
Filter options
Expand file treeCollapse file tree

1 file changed

+1
-0
lines changed
Open diff view settings
Collapse file

‎src/node_buffer.cc‎

Copy file name to clipboardExpand all lines: src/node_buffer.cc
+1Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -497,6 +497,7 @@ MaybeLocal<Object> New(Environment* env,
497497
if (length > kMaxLength) {
498498
Isolate* isolate(env->isolate());
499499
isolate->ThrowException(ERR_BUFFER_TOO_LARGE(isolate));
500+
free(data);
500501
return Local<Object>();
501502
}
502503
}

0 commit comments

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