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
Backport-PR-URL: #19447
PR-URL: #17714
Reviewed-By: Alexey Orlenko <eaglexrlnk@gmail.com>
Reviewed-By: Anna Henningsen <anna@addaleax.net>
Reviewed-By: Colin Ihrig <cjihrig@gmail.com>
Reviewed-By: Timothy Gu <timothygu99@gmail.com>
Reviewed-By: James M Snell <jasnell@gmail.com>
  • Loading branch information
alnyan authored and MylesBorins committed Apr 16, 2018
1 parent 412cc17 commit 65ea7ab
Showing 1 changed file with 2 additions and 0 deletions.
2 changes: 2 additions & 0 deletions src/node_api.cc
Expand Up @@ -2864,6 +2864,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 65ea7ab

Please sign in to comment.