Skip to content

Commit

Permalink
src: free preopen memory in WASI::New()
Browse files Browse the repository at this point in the history
PR-URL: #30809
Refs: #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>
  • Loading branch information
cjihrig authored and targos committed Dec 9, 2019
1 parent e6e379e commit 8ad53ab
Showing 1 changed file with 9 additions and 0 deletions.
9 changes: 9 additions & 0 deletions src/node_wasi.cc
Original file line number Diff line number Diff line change
Expand Up @@ -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;
}
}


Expand Down

0 comments on commit 8ad53ab

Please sign in to comment.