Skip to content

Commit

Permalink
n-api: fix memory leak in napi_async_destroy()
Browse files Browse the repository at this point in the history
This is a cherry-pick patch from upstream[1].

[1] nodejs/node@87cb1f5

PR-URL: nodejs/node-addon-api#213
Reviewed-By: Michael Dawson <michael_dawson@ca.ibm.com>
  • Loading branch information
kevindavies8 committed Jan 18, 2018
1 parent 4a78387 commit 0222495
Showing 1 changed file with 2 additions and 0 deletions.
2 changes: 2 additions & 0 deletions src/node_api.cc
Original file line number Diff line number Diff line change
Expand Up @@ -2855,6 +2855,8 @@ napi_status napi_async_destroy(napi_env env,
reinterpret_cast<node::async_context*>(async_context);
node::EmitAsyncDestroy(isolate, *node_async_context);

delete node_async_context;

return napi_clear_last_error(env);
}

Expand Down

0 comments on commit 0222495

Please sign in to comment.