async_wrap: fix memory leak in AsyncResource

Reset the persistent that keeps the resource
Object alive when the AsyncResource is being
destroyed.

Fixes: https://github.com/nodejs/node-addon-api/issues/237

PR-URL: https://github.com/nodejs/node/pull/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>
This commit is contained in:
Michael Dawson authored and Anna Henningsen committed 2018-05-14 19:21:49 +02:00
1 parent 2a7c863d3d
commit e61337d36d
1 file changed
+1
+1
View File
@@ -714,6 +714,7 @@ class AsyncResource {
virtual ~AsyncResource() {
EmitAsyncDestroy(isolate_, async_context_);
resource_.Reset();
}
v8::MaybeLocal<v8::Value> MakeCallback(