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: nodejs#20668
Reviewed-By: Anna Henningsen <anna@addaleax.net>
Reviewed-By: Tiancheng "Timothy" Gu <timothygu99@gmail.com>
Reviewed-By: Gabriel Schulhof <gabriel.schulhof@intel.com>
Reviewed-By: James M Snell <jasnell@gmail.com>
  • Loading branch information
mhdawson authored and MylesBorins committed Jul 10, 2018
1 parent f4b9985 commit 90cde52
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 @@ -735,6 +735,7 @@ class AsyncResource {

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

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

0 comments on commit 90cde52

Please sign in to comment.