From 8f5e9916d1ccf52a2216fe8ec9a3cb4f4a95d6ed Mon Sep 17 00:00:00 2001 From: Michael Dawson Date: Fri, 11 May 2018 00:25:59 -0400 Subject: [PATCH] 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 Reviewed-By: Tiancheng "Timothy" Gu Reviewed-By: Gabriel Schulhof Reviewed-By: James M Snell --- src/node.h | 1 + 1 file changed, 1 insertion(+) diff --git a/src/node.h b/src/node.h index 3322f9ebcd366d..d08c4633778834 100644 --- a/src/node.h +++ b/src/node.h @@ -735,6 +735,7 @@ class AsyncResource { virtual ~AsyncResource() { EmitAsyncDestroy(isolate_, async_context_); + resource_.Reset(); } v8::MaybeLocal MakeCallback(