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: #16898
Reviewed-By: Franziska Hinkelmann <[email protected]>
Reviewed-By: Anna Henningsen <[email protected]>
Reviewed-By: Colin Ihrig <[email protected]>
Reviewed-By: Khaidi Chu <[email protected]>
  • 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.