From 70b6263270e1b4487b5aed578057d8bb50659a4e Mon Sep 17 00:00:00 2001 From: Anna Henningsen Date: Sat, 21 Mar 2020 10:08:08 +0100 Subject: [PATCH] src: delete CallbackInfo when cleared from cleanup hook Fixes: https://github.com/nodejs/node/issues/32400 --- src/node_buffer.cc | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/node_buffer.cc b/src/node_buffer.cc index 3d402335ba3c3d..9faf82e04a4c7c 100644 --- a/src/node_buffer.cc +++ b/src/node_buffer.cc @@ -163,7 +163,6 @@ void CallbackInfo::WeakCallback( const WeakCallbackInfo& data) { CallbackInfo* self = data.GetParameter(); self->WeakCallback(data.GetIsolate()); - delete self; } @@ -171,6 +170,7 @@ void CallbackInfo::WeakCallback(Isolate* isolate) { callback_(data_, hint_); int64_t change_in_bytes = -static_cast(sizeof(*this)); isolate->AdjustAmountOfExternalAllocatedMemory(change_in_bytes); + delete this; }