Skip to content

Commit 8ad53ab

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 e6e379e commit 8ad53ab

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
@@ -163,6 +163,15 @@ void WASI::New(const FunctionCallbackInfo<Value>& args) {
163163
free(options.envp[i]);
164164
delete[] options.envp;
165165
}
166+
167+
if (options.preopens != nullptr) {
168+
for (uint32_t i = 0; i < options.preopenc; i++) {
169+
free(options.preopens[i].mapped_path);
170+
free(options.preopens[i].real_path);
171+
}
172+
173+
delete[] options.preopens;
174+
}
166175
}
167176

168177

0 commit comments

Comments
 (0)