From 94e29510d93811ff0792260a6c2ec3f72f43558c Mon Sep 17 00:00:00 2001 From: alnyan Date: Sun, 17 Dec 2017 12:22:46 +0200 Subject: [PATCH] n-api: fix memory leak in napi_async_destroy() PR-URL: https://github.com/nodejs/node/pull/17714 Reviewed-By: Alexey Orlenko Reviewed-By: Anna Henningsen Reviewed-By: Colin Ihrig Reviewed-By: Timothy Gu Reviewed-By: James M Snell --- src/node_api.cc | 2 ++ 1 file changed, 2 insertions(+) diff --git a/src/node_api.cc b/src/node_api.cc index f16ceefd5eb5b9..ac0b0959b599d6 100644 --- a/src/node_api.cc +++ b/src/node_api.cc @@ -2770,6 +2770,8 @@ napi_status napi_async_destroy(napi_env env, reinterpret_cast(async_context); node::EmitAsyncDestroy(isolate, *node_async_context); + delete node_async_context; + return napi_clear_last_error(env); }