From 68accb5b04503d005c94030d16f3e24fc98fcdfc Mon Sep 17 00:00:00 2001 From: Daniel Bevenius Date: Thu, 21 Feb 2019 08:38:05 +0100 Subject: [PATCH] src: use smart pointer in UDPWrap::OnSend PR-URL: https://github.com/nodejs/node/pull/26233 Reviewed-By: Anna Henningsen Reviewed-By: Colin Ihrig Reviewed-By: James M Snell --- src/udp_wrap.cc | 3 +-- 1 file changed, 1 insertion(+), 2 deletions(-) diff --git a/src/udp_wrap.cc b/src/udp_wrap.cc index be1f59d2c52863..5702ba5ad2fe7d 100644 --- a/src/udp_wrap.cc +++ b/src/udp_wrap.cc @@ -444,7 +444,7 @@ void UDPWrap::RecvStop(const FunctionCallbackInfo& args) { void UDPWrap::OnSend(uv_udp_send_t* req, int status) { - SendWrap* req_wrap = static_cast(req->data); + std::unique_ptr req_wrap{static_cast(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; }