mirror of
https://github.com/nodejs/node.git
synced 2026-11-29 14:27:57 -05:00
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 https://github.com/nodejs/node/pull/49691. Fixes: https://github.com/nodejs/node/issues/57800 PR-URL: https://github.com/nodejs/node/pull/57811 Reviewed-By: Matteo Collina <matteo.collina@gmail.com> Reviewed-By: James M Snell <jasnell@gmail.com>
This commit is contained in:
1 parent
c08349393b
commit
52e4967f45
1 file changed
+1
-1
+1
-1
@@ -2711,10 +2711,10 @@ static void ReadFileUtf8(const FunctionCallbackInfo<Value>& args) {
|
||||
FS_SYNC_TRACE_END(open);
|
||||
if (req.result < 0) {
|
||||
uv_fs_req_cleanup(&req);
|
||||
// req will be cleaned up by scope leave.
|
||||
return env->ThrowUVException(
|
||||
static_cast<int>(req.result), "open", nullptr, path.out());
|
||||
}
|
||||
uv_fs_req_cleanup(&req);
|
||||
}
|
||||
|
||||
auto defer_close = OnScopeLeave([file, is_fd, &req]() {
|
||||
|
||||
Reference in new issue
Block a user