src: use smart pointer in UDPWrap::OnSend

PR-URL: https://github.com/nodejs/node/pull/26233
Reviewed-By: Anna Henningsen <anna@addaleax.net>
Reviewed-By: Colin Ihrig <cjihrig@gmail.com>
Reviewed-By: James M Snell <jasnell@gmail.com>
This commit is contained in:
Daniel Bevenius 2019-02-21 08:38:05 +01:00
parent 84e02b178a
commit 47c784203c

View File

@ -444,7 +444,7 @@ void UDPWrap::RecvStop(const FunctionCallbackInfo<Value>& args) {
void UDPWrap::OnSend(uv_udp_send_t* req, int status) {
SendWrap* req_wrap = static_cast<SendWrap*>(req->data);
std::unique_ptr<SendWrap> req_wrap{static_cast<SendWrap*>(req->data)};
if (req_wrap->have_callback()) {
Environment* env = req_wrap->env();
HandleScope handle_scope(env->isolate());
@ -455,7 +455,6 @@ void UDPWrap::OnSend(uv_udp_send_t* req, int status) {
};
req_wrap->MakeCallback(env->oncomplete_string(), 2, arg);
}
delete req_wrap;
}