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 BethGriggs committed Feb 6, 2020
1 parent e9bda66 commit bf78914
Showing 1 changed file with 9 additions and 0 deletions.
9 changes: 9 additions & 0 deletions src/node_wasi.cc
Expand Up @@ -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;
}
}


Expand Down

0 comments on commit bf78914

Please sign in to comment.