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>
This commit is contained in:
cjihrig authored and Beth Griggs committed 2020-02-06 02:49:27 +00:00
1 parent e9bda6618d
commit bf789145d9
1 file changed
+9
+9
View File
@@ -162,6 +162,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;
}
}