Skip to content

Commit 9f403e9

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 3f5899f commit 9f403e9

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
@@ -2594,10 +2594,10 @@ static void ReadFileUtf8(const FunctionCallbackInfo<Value>& args) {
25942594
FS_SYNC_TRACE_END(open);
25952595
if (req.result < 0) {
25962596
uv_fs_req_cleanup(&req);
2597-
// req will be cleaned up by scope leave.
25982597
return env->ThrowUVException(
25992598
static_cast<int>(req.result), "open", nullptr, path.out());
26002599
}
2600+
uv_fs_req_cleanup(&req);
26012601
}
26022602

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

0 commit comments

Comments
 (0)