Skip to content

Commit

Permalink
async_wrap: fix memory leak in AsyncResource
Browse files Browse the repository at this point in the history
Reset the persistent that keeps the resource
Object alive when the AsyncResource is being
destroyed.

Fixes: nodejs/node-addon-api#237

PR-URL: #20668
Reviewed-By: Anna Henningsen <[email protected]>
Reviewed-By: Tiancheng "Timothy" Gu <[email protected]>
Reviewed-By: Gabriel Schulhof <[email protected]>
Reviewed-By: James M Snell <[email protected]>
  • Loading branch information
mhdawson authored and addaleax committed May 14, 2018
1 parent fb93984 commit 1248ce1
Showing 1 changed file with 1 addition and 0 deletions.
1 change: 1 addition & 0 deletions src/node.h
Original file line number Diff line number Diff line change
Expand Up @@ -714,6 +714,7 @@ class AsyncResource {

virtual ~AsyncResource() {
EmitAsyncDestroy(isolate_, async_context_);
resource_.Reset();
}

v8::MaybeLocal<v8::Value> MakeCallback(
Expand Down

0 comments on commit 1248ce1

Please sign in to comment.