Skip to content

Commit

Permalink
src: fix fs_stats_field_array memory leak
Browse files Browse the repository at this point in the history
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 <[email protected]>
  • Loading branch information
addaleax authored and jasnell committed Oct 1, 2017
1 parent 022d332 commit a4e8e9e
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 @@ -334,6 +334,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 @@ -723,7 +723,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 a4e8e9e

Please sign in to comment.