Skip to content

Commit

Permalink
src: perf_hooks: fix wrong sized delete
Browse files Browse the repository at this point in the history
Depending on the allocator, existing code leaks memory.

PR-URL: nodejs#16898
Reviewed-By: Franziska Hinkelmann <franziska.hinkelmann@gmail.com>
Reviewed-By: Anna Henningsen <anna@addaleax.net>
Reviewed-By: Colin Ihrig <cjihrig@gmail.com>
Reviewed-By: Khaidi Chu <i@2333.moe>
  • Loading branch information
ofrobots committed Nov 17, 2017
1 parent eeab7bc commit d37789d
Showing 1 changed file with 3 additions and 1 deletion.
4 changes: 3 additions & 1 deletion src/node_perf.cc
Original file line number Diff line number Diff line change
Expand Up @@ -196,7 +196,9 @@ void PerformanceGCCallback(uv_async_t* handle) {

cleanup:
delete data;
auto closeCB = [](uv_handle_t* handle) { delete handle; };
auto closeCB = [](uv_handle_t* handle) {
delete reinterpret_cast<uv_async_t*>(handle);
};
uv_close(reinterpret_cast<uv_handle_t*>(handle), closeCB);
}

Expand Down

0 comments on commit d37789d

Please sign in to comment.