diff options
author | cjihrig <cjihrig@gmail.com> | 2019-12-05 18:21:16 +0300 |
---|---|---|
committer | Michaƫl Zasso <targos@protonmail.com> | 2019-12-09 12:23:14 +0300 |
commit | 8ad53ab2b72338ced4ccbf9b6fab61bda08e9b73 (patch) | |
tree | 503942eaa3309963e1d0136dbdbd6b93362a24ec /src/node_wasi.cc | |
parent | e6e379ea41ee1d67ce662533d10e0ff0c74f499f (diff) |
src: free preopen memory in WASI::New()
PR-URL: https://github.com/nodejs/node/pull/30809
Refs: https://github.com/nodejs/node/issues/30257
Reviewed-By: Anna Henningsen <anna@addaleax.net>
Reviewed-By: Jiawen Geng <technicalcute@gmail.com>
Reviewed-By: Rich Trott <rtrott@gmail.com>
Reviewed-By: David Carlier <devnexen@gmail.com>
Diffstat (limited to 'src/node_wasi.cc')
-rw-r--r-- | src/node_wasi.cc | 9 |
1 files changed, 9 insertions, 0 deletions
diff --git a/src/node_wasi.cc b/src/node_wasi.cc index b3b266f5cfe..e9bcb42ad6b 100644 --- a/src/node_wasi.cc +++ b/src/node_wasi.cc @@ -163,6 +163,15 @@ void WASI::New(const FunctionCallbackInfo<Value>& args) { free(options.envp[i]); delete[] options.envp; } + + if (options.preopens != nullptr) { + for (uint32_t i = 0; i < options.preopenc; i++) { + free(options.preopens[i].mapped_path); + free(options.preopens[i].real_path); + } + + delete[] options.preopens; + } } |