diff options
Diffstat (limited to 'src')
-rw-r--r-- | src/connection_wrap.cc | 5 |
1 files changed, 2 insertions, 3 deletions
diff --git a/src/connection_wrap.cc b/src/connection_wrap.cc index 3021307c06..db239f9bec 100644 --- a/src/connection_wrap.cc +++ b/src/connection_wrap.cc @@ -77,7 +77,8 @@ void ConnectionWrap<WrapType, UVType>::OnConnection(uv_stream_t* handle, template <typename WrapType, typename UVType> void ConnectionWrap<WrapType, UVType>::AfterConnect(uv_connect_t* req, int status) { - ConnectWrap* req_wrap = static_cast<ConnectWrap*>(req->data); + std::unique_ptr<ConnectWrap> req_wrap + (static_cast<ConnectWrap*>(req->data)); CHECK_NOT_NULL(req_wrap); WrapType* wrap = static_cast<WrapType*>(req->handle->data); CHECK_EQ(req_wrap->env(), wrap->env()); @@ -108,8 +109,6 @@ void ConnectionWrap<WrapType, UVType>::AfterConnect(uv_connect_t* req, }; req_wrap->MakeCallback(env->oncomplete_string(), arraysize(argv), argv); - - delete req_wrap; } template ConnectionWrap<PipeWrap, uv_pipe_t>::ConnectionWrap( |