Skip to content

Commit 9e13bf0

Browse files
Justin-NietzelRafaelGSS
authored andcommitted
fs: add missing call to uv_fs_req_cleanup
Always call uv_fs_req_cleanup after calling uv_fs_open instead of just when uv_fs_open returns a negative result. I referenced ReadFileSync from node:js2c when making this change. https://github.com/bnoordhuis made the same suggestion based on the PR #49691. Fixes: #57800 PR-URL: #57811 Reviewed-By: Matteo Collina <[email protected]> Reviewed-By: James M Snell <[email protected]> CVE-ID: CVE-2025-23165
1 parent bd0aa5d commit 9e13bf0

File tree

1 file changed

+1
-1
lines changed

1 file changed

+1
-1
lines changed

src/node_file.cc

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -2615,9 +2615,9 @@ static void ReadFileUtf8(const FunctionCallbackInfo<Value>& args) {
26152615
FS_SYNC_TRACE_END(open);
26162616
if (req.result < 0) {
26172617
uv_fs_req_cleanup(&req);
2618-
// req will be cleaned up by scope leave.
26192618
return env->ThrowUVException(req.result, "open", nullptr, path.out());
26202619
}
2620+
uv_fs_req_cleanup(&req);
26212621
}
26222622

26232623
auto defer_close = OnScopeLeave([file, is_fd, &req]() {

0 commit comments

Comments
 (0)