Skip to content

Commit 20a4f14

Browse files
danbevtargos
authored andcommitted
src: make req_wrap a unique_ptr in AfterConnect
PR-URL: #23115 Reviewed-By: Gireesh Punathil <[email protected]> Reviewed-By: Michaël Zasso <[email protected]> Reviewed-By: Anna Henningsen <[email protected]> Reviewed-By: Colin Ihrig <[email protected]> Reviewed-By: Sakthipriyan Vairamani <[email protected]> Reviewed-By: Joyee Cheung <[email protected]> Reviewed-By: James M Snell <[email protected]>
1 parent ce7fad5 commit 20a4f14

File tree

1 file changed

+2
-3
lines changed

1 file changed

+2
-3
lines changed

src/connection_wrap.cc

+2-3
Original file line numberDiff line numberDiff line change
@@ -77,7 +77,8 @@ void ConnectionWrap<WrapType, UVType>::OnConnection(uv_stream_t* handle,
7777
template <typename WrapType, typename UVType>
7878
void ConnectionWrap<WrapType, UVType>::AfterConnect(uv_connect_t* req,
7979
int status) {
80-
ConnectWrap* req_wrap = static_cast<ConnectWrap*>(req->data);
80+
std::unique_ptr<ConnectWrap> req_wrap
81+
(static_cast<ConnectWrap*>(req->data));
8182
CHECK_NOT_NULL(req_wrap);
8283
WrapType* wrap = static_cast<WrapType*>(req->handle->data);
8384
CHECK_EQ(req_wrap->env(), wrap->env());
@@ -108,8 +109,6 @@ void ConnectionWrap<WrapType, UVType>::AfterConnect(uv_connect_t* req,
108109
};
109110

110111
req_wrap->MakeCallback(env->oncomplete_string(), arraysize(argv), argv);
111-
112-
delete req_wrap;
113112
}
114113

115114
template ConnectionWrap<PipeWrap, uv_pipe_t>::ConnectionWrap(

0 commit comments

Comments
 (0)