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 <[email protected]>
Reviewed-By: Jiawen Geng <[email protected]>
Reviewed-By: Rich Trott <[email protected]>
Reviewed-By: David Carlier <[email protected]>
  • 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.