mirror of
https://github.com/nodejs/node.git
synced 2026-11-24 21:50:36 -05:00
src: fix handle leak in BuildStatsObject()
Create a handle scope before performing a check that creates a handle, otherwise the handle is leaked into the handle scope of the caller. PR-URL: https://github.com/nodejs/node/pull/7711 Reviewed-By: Anna Henningsen <anna@addaleax.net> Reviewed-By: Colin Ihrig <cjihrig@gmail.com> Reviewed-By: Trevor Norris <trev.norris@gmail.com>
This commit is contained in:
1 parent
7aa268922a
commit
dadcf6b263
1 file changed
+2
-2
+2
-2
@@ -344,11 +344,11 @@ static void Close(const FunctionCallbackInfo<Value>& args) {
|
||||
|
||||
|
||||
Local<Value> BuildStatsObject(Environment* env, const uv_stat_t* s) {
|
||||
EscapableHandleScope handle_scope(env->isolate());
|
||||
|
||||
// If you hit this assertion, you forgot to enter the v8::Context first.
|
||||
CHECK_EQ(env->context(), env->isolate()->GetCurrentContext());
|
||||
|
||||
EscapableHandleScope handle_scope(env->isolate());
|
||||
|
||||
// The code below is very nasty-looking but it prevents a segmentation fault
|
||||
// when people run JS code like the snippet below. It's apparently more
|
||||
// common than you would expect, several people have reported this crash...
|
||||
|
||||
Reference in new issue
Block a user