Skip to content

Commit 5c6aa32

Browse files
committed
src: fix fs_stats_field_array memory leak
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#82
1 parent bd74ef1 commit 5c6aa32

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
@@ -332,6 +332,7 @@ inline Environment::~Environment() {
332332
delete[] heap_space_statistics_buffer_;
333333
delete[] http_parser_buffer_;
334334
delete http2_state_;
335+
delete[] fs_stats_field_array_;
335336
free(performance_state_);
336337
}
337338

src/env.h

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

724-
double* fs_stats_field_array_;
724+
double* fs_stats_field_array_ = nullptr;
725725

726726
struct AtExitCallback {
727727
void (*cb_)(void* arg);

0 commit comments

Comments
 (0)