summaryrefslogtreecommitdiff
path: root/src/udp_wrap.cc
diff options
context:
space:
mode:
authorBen Noordhuis <info@bnoordhuis.nl>2016-07-13 16:16:52 +0200
committerBen Noordhuis <info@bnoordhuis.nl>2016-07-18 10:53:04 +0200
commit4e989b00a388de9547654401f37f3bfc2e2250bb (patch)
treeb6db38592d864a6d50fa7c26fb29747760531a24 /src/udp_wrap.cc
parentc354b241a73e51ac41cde2ab5c41df1e9af7e455 (diff)
downloadandroid-node-v8-4e989b00a388de9547654401f37f3bfc2e2250bb.tar.gz
android-node-v8-4e989b00a388de9547654401f37f3bfc2e2250bb.tar.bz2
android-node-v8-4e989b00a388de9547654401f37f3bfc2e2250bb.zip
src: fix handle leak in UDPWrap::Instantiate()
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/udp_wrap.cc')
-rw-r--r--src/udp_wrap.cc2
1 files changed, 1 insertions, 1 deletions
diff --git a/src/udp_wrap.cc b/src/udp_wrap.cc
index bd7aa418bd..a0d8b1f761 100644
--- a/src/udp_wrap.cc
+++ b/src/udp_wrap.cc
@@ -436,9 +436,9 @@ void UDPWrap::OnRecv(uv_udp_t* handle,
Local<Object> UDPWrap::Instantiate(Environment* env, AsyncWrap* parent) {
+ EscapableHandleScope scope(env->isolate());
// If this assert fires then Initialize hasn't been called yet.
CHECK_EQ(env->udp_constructor_function().IsEmpty(), false);
- EscapableHandleScope scope(env->isolate());
Local<Value> ptr = External::New(env->isolate(), parent);
return scope.Escape(env->udp_constructor_function()
->NewInstance(env->context(), 1, &ptr).ToLocalChecked());