Skip to content

Commit

Permalink
src: fix fs_stats_field_array memory leak
Browse files Browse the repository at this point in the history
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
  • Loading branch information
addaleax committed Sep 26, 2017
1 parent bd74ef1 commit 5c6aa32
Show file tree
Hide file tree
Showing 2 changed files with 2 additions and 1 deletion.
1 change: 1 addition & 0 deletions src/env-inl.h
Original file line number Diff line number Diff line change
Expand Up @@ -332,6 +332,7 @@ inline Environment::~Environment() {
delete[] heap_space_statistics_buffer_;
delete[] http_parser_buffer_;
delete http2_state_;
delete[] fs_stats_field_array_;
free(performance_state_);
}

Expand Down
2 changes: 1 addition & 1 deletion src/env.h
Original file line number Diff line number Diff line change
Expand Up @@ -721,7 +721,7 @@ class Environment {
char* http_parser_buffer_;
http2::http2_state* http2_state_ = nullptr;

double* fs_stats_field_array_;
double* fs_stats_field_array_ = nullptr;

struct AtExitCallback {
void (*cb_)(void* arg);
Expand Down

0 comments on commit 5c6aa32

Please sign in to comment.