summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorcjihrig <cjihrig@gmail.com>2019-12-05 10:21:16 -0500
committerRich Trott <rtrott@gmail.com>2019-12-07 10:06:33 -0800
commit46aa7d091fbfaf9d18a46d821dbabf3b4f34119d (patch)
treebc2d9c9410c825a3bdf1fb2979e95e8c1af00607
parent0fe54f282648996d5672436955b23c0fd8952633 (diff)
downloadandroid-node-v8-46aa7d091fbfaf9d18a46d821dbabf3b4f34119d.tar.gz
android-node-v8-46aa7d091fbfaf9d18a46d821dbabf3b4f34119d.tar.bz2
android-node-v8-46aa7d091fbfaf9d18a46d821dbabf3b4f34119d.zip
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>
-rw-r--r--src/node_wasi.cc9
1 files changed, 9 insertions, 0 deletions
diff --git a/src/node_wasi.cc b/src/node_wasi.cc
index b3b266f5cf..e9bcb42ad6 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;
+ }
}