Skip to content

Commit a4e8e9e

Browse files
addaleaxjasnell
authored andcommitted
src: fix fs_stats_field_array memory leak
Original PR: ayojs/ayo#82 > Previously, the `Environment` destructor did not release its > `fs_stats_field_array` memory. The memory is allocated when the > `fs` module is initialized and calls `GetStatValues()`. > PR-URL: ayojs/ayo#82 > Reviewed-By: Stephen Belanger <admin@stephenbelanger.com>
1 parent 022d332 commit a4e8e9e

File tree

2 files changed

+2
-1
lines changed

2 files changed

+2
-1
lines changed

src/env-inl.h

+1
Original file line numberDiff line numberDiff line change
@@ -334,6 +334,7 @@ inline Environment::~Environment() {
334334
delete[] heap_space_statistics_buffer_;
335335
delete[] http_parser_buffer_;
336336
delete http2_state_;
337+
delete[] fs_stats_field_array_;
337338
free(performance_state_);
338339
}
339340

src/env.h

+1-1
Original file line numberDiff line numberDiff line change
@@ -723,7 +723,7 @@ class Environment {
723723
char* http_parser_buffer_;
724724
http2::http2_state* http2_state_ = nullptr;
725725

726-
double* fs_stats_field_array_;
726+
double* fs_stats_field_array_ = nullptr;
727727

728728
struct AtExitCallback {
729729
void (*cb_)(void* arg);

0 commit comments

Comments
 (0)