Skip to content

Commit 68accb5

Browse files
danbevrvagg
authored andcommitted
src: use smart pointer in UDPWrap::OnSend
PR-URL: #26233 Reviewed-By: Anna Henningsen <[email protected]> Reviewed-By: Colin Ihrig <[email protected]> Reviewed-By: James M Snell <[email protected]>
1 parent d915207 commit 68accb5

File tree

1 file changed

+1
-2
lines changed

1 file changed

+1
-2
lines changed

src/udp_wrap.cc

+1-2
Original file line numberDiff line numberDiff line change
@@ -444,7 +444,7 @@ void UDPWrap::RecvStop(const FunctionCallbackInfo<Value>& args) {
444444

445445

446446
void UDPWrap::OnSend(uv_udp_send_t* req, int status) {
447-
SendWrap* req_wrap = static_cast<SendWrap*>(req->data);
447+
std::unique_ptr<SendWrap> req_wrap{static_cast<SendWrap*>(req->data)};
448448
if (req_wrap->have_callback()) {
449449
Environment* env = req_wrap->env();
450450
HandleScope handle_scope(env->isolate());
@@ -455,7 +455,6 @@ void UDPWrap::OnSend(uv_udp_send_t* req, int status) {
455455
};
456456
req_wrap->MakeCallback(env->oncomplete_string(), 2, arg);
457457
}
458-
delete req_wrap;
459458
}
460459

461460

0 commit comments

Comments
 (0)