From 0993a17b7f52ba40db6748c10560834991daa5de Mon Sep 17 00:00:00 2001 From: Orgad Shaneh Date: Tue, 24 Aug 2021 20:08:55 +0300 Subject: [PATCH] Fix double free --- src/GcProfiler.cc | 6 +----- 1 file changed, 1 insertion(+), 5 deletions(-) diff --git a/src/GcProfiler.cc b/src/GcProfiler.cc index b0ee703..718d0bc 100644 --- a/src/GcProfiler.cc +++ b/src/GcProfiler.cc @@ -13,8 +13,6 @@ using namespace v8; -static Nan::AsyncResource* async_resource; - namespace GcProfiler { struct GcProfilerData @@ -72,7 +70,6 @@ namespace GcProfiler _callback.Reset(info[0].As()); - async_resource = new Nan::AsyncResource("loadProfiler"); Nan::AddGCPrologueCallback(Before); Nan::AddGCEpilogueCallback(After); @@ -117,9 +114,8 @@ namespace GcProfiler }; delete data; - async_resource->runInAsyncScope( + Nan::AsyncResource("loadProfiler").runInAsyncScope( Nan::GetCurrentContext()->Global(), Nan::New(_callback), argc, argv); - delete async_resource; } #ifdef __MACH__