FazBrowse GitHub Viewer | Trending |
URL:
| Home
Tools: [Download Repo ZIP]   [Original HTTPS Page]

src: fix handle leak in UDPWrap::Instantiate() · nodejs/node@6838ad5 · GitHub

/ node Public

Commit 6838ad5

Browse files
authored andcommitted
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: #7711 Reviewed-By: Anna Henningsen <anna@addaleax.net> Reviewed-By: Colin Ihrig <cjihrig@gmail.com> Reviewed-By: Trevor Norris <trev.norris@gmail.com>
1 parent dadcf6b commit 6838ad5

1 file changed

Lines changed: 1 addition & 1 deletion

File tree

‎src/udp_wrap.cc‎

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -394,9 +394,9 @@ void UDPWrap::OnRecv(uv_udp_t* handle,
394394

395395

396396
Local<Object> UDPWrap::Instantiate(Environment* env, AsyncWrap* parent) {
397+
EscapableHandleScope scope(env->isolate());
397398
// If this assert fires then Initialize hasn't been called yet.
398399
CHECK_EQ(env->udp_constructor_function().IsEmpty(), false);
399-
EscapableHandleScope scope(env->isolate());
400400
Local<Value> ptr = External::New(env->isolate(), parent);
401401
return scope.Escape(env->udp_constructor_function()->NewInstance(1, &ptr));
402402
}

0 commit comments

Comments
 (0)

Back | FazBrowse Home | New Git URL