Skip to content

Commit bf78914

Browse files
cjihrigBethGriggs
authored andcommittedFeb 6, 2020
src: free preopen memory in WASI::New()
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>
1 parent e9bda66 commit bf78914

File tree

1 file changed

+9
-0
lines changed

1 file changed

+9
-0
lines changed
 

‎src/node_wasi.cc

+9
Original file line numberDiff line numberDiff line change
@@ -162,6 +162,15 @@ void WASI::New(const FunctionCallbackInfo<Value>& args) {
162162
free(options.envp[i]);
163163
delete[] options.envp;
164164
}
165+
166+
if (options.preopens != nullptr) {
167+
for (uint32_t i = 0; i < options.preopenc; i++) {
168+
free(options.preopens[i].mapped_path);
169+
free(options.preopens[i].real_path);
170+
}
171+
172+
delete[] options.preopens;
173+
}
165174
}
166175

167176

0 commit comments

Comments
 (0)
Please sign in to comment.