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 Michaël Zasso committed 2019-12-09 10:23:14 +01:00
1 parent e6e379ea41
commit 8ad53ab2b7
1 file changed
+9
+9
View File
@@ -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;
}
}