Skip to content

Commit 1148724

Browse files
cjihrigtargos
authored andcommitted
src: free preopen memory in WASI::New()
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]>
1 parent 808a456 commit 1148724

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)