Skip to content

Commit bc9df87

Browse files
Free req.file.pathw in fs::ReadFileUtf8().
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
1 parent 038d829 commit bc9df87

File tree

1 file changed

+1
-1
lines changed

1 file changed

+1
-1
lines changed

Diff for: src/node_file.cc

+1-1
Original file line numberDiff line numberDiff line change
@@ -2711,10 +2711,10 @@ static void ReadFileUtf8(const FunctionCallbackInfo<Value>& args) {
27112711
FS_SYNC_TRACE_END(open);
27122712
if (req.result < 0) {
27132713
uv_fs_req_cleanup(&req);
2714-
// req will be cleaned up by scope leave.
27152714
return env->ThrowUVException(
27162715
static_cast<int>(req.result), "open", nullptr, path.out());
27172716
}
2717+
uv_fs_req_cleanup(&req);
27182718
}
27192719

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

0 commit comments

Comments
 (0)