Skip to content

Commit

Permalink
Fix double free
Browse files Browse the repository at this point in the history
  • Loading branch information
orgads committed Aug 24, 2021
1 parent c658af3 commit 0993a17
Showing 1 changed file with 1 addition and 5 deletions.
6 changes: 1 addition & 5 deletions src/GcProfiler.cc
Original file line number Diff line number Diff line change
Expand Up @@ -13,8 +13,6 @@

using namespace v8;

static Nan::AsyncResource* async_resource;

namespace GcProfiler
{
struct GcProfilerData
Expand Down Expand Up @@ -72,7 +70,6 @@ namespace GcProfiler

_callback.Reset(info[0].As<v8::Function>());

async_resource = new Nan::AsyncResource("loadProfiler");
Nan::AddGCPrologueCallback(Before);
Nan::AddGCEpilogueCallback(After);

Expand Down Expand Up @@ -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__
Expand Down

0 comments on commit 0993a17

Please sign in to comment.