summaryrefslogtreecommitdiff
path: root/src/node.h
diff options
context:
space:
mode:
authorMichael Dawson <michael_dawson@ca.ibm.com>2018-05-11 00:25:59 -0400
committerAnna Henningsen <anna@addaleax.net>2018-05-14 18:32:11 +0200
commit1248ce1645bb13724e5f4b5db940afd0b6221eda (patch)
treee6403a57360ba672481af379389cb68fe8ad19d6 /src/node.h
parentfb939844454818055434b0635d1482d737662415 (diff)
downloadandroid-node-v8-1248ce1645bb13724e5f4b5db940afd0b6221eda.tar.gz
android-node-v8-1248ce1645bb13724e5f4b5db940afd0b6221eda.tar.bz2
android-node-v8-1248ce1645bb13724e5f4b5db940afd0b6221eda.zip
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>
Diffstat (limited to 'src/node.h')
-rw-r--r--src/node.h1
1 files changed, 1 insertions, 0 deletions
diff --git a/src/node.h b/src/node.h
index 5d6aa8dadf..2ac145f4f7 100644
--- a/src/node.h
+++ b/src/node.h
@@ -714,6 +714,7 @@ class AsyncResource {
virtual ~AsyncResource() {
EmitAsyncDestroy(isolate_, async_context_);
+ resource_.Reset();
}
v8::MaybeLocal<v8::Value> MakeCallback(