diff options
author | Ben Noordhuis <info@bnoordhuis.nl> | 2016-07-13 16:16:40 +0200 |
---|---|---|
committer | Ben Noordhuis <info@bnoordhuis.nl> | 2016-07-18 10:53:02 +0200 |
commit | c354b241a73e51ac41cde2ab5c41df1e9af7e455 (patch) | |
tree | 40ccc18e04721f8325f3225143d721bdc45fbdc8 /src/node_file.cc | |
parent | 6754bae82f97bd2df9b67faf5e8763108cf51925 (diff) | |
download | android-node-v8-c354b241a73e51ac41cde2ab5c41df1e9af7e455.tar.gz android-node-v8-c354b241a73e51ac41cde2ab5c41df1e9af7e455.tar.bz2 android-node-v8-c354b241a73e51ac41cde2ab5c41df1e9af7e455.zip |
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>
Diffstat (limited to 'src/node_file.cc')
-rw-r--r-- | src/node_file.cc | 4 |
1 files changed, 2 insertions, 2 deletions
diff --git a/src/node_file.cc b/src/node_file.cc index 968284788a..1fdef68ca6 100644 --- a/src/node_file.cc +++ b/src/node_file.cc @@ -420,11 +420,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... |