src: fix some recently introduced coverity issues

Signed-off-by: Michael Dawson <mdawson@devrus.com>

PR-URL: https://github.com/nodejs/node/pull/47240
Reviewed-By: Richard Lau <rlau@redhat.com>
Reviewed-By: Luigi Pinca <luigipinca@gmail.com>
This commit is contained in:
Michael Dawson authored and RafaelGSS committed 2023-04-07 09:14:34 -03:00
1 parent bd4697a2a3
commit d0a5e7e342
2 files changed
+3 -3

No files matched your search

+2 -2
View File
@@ -787,7 +787,7 @@ class FdEntry final : public EntryImpl {
public:
static std::unique_ptr<FdEntry> Create(Environment* env, Local<Value> path) {
// We're only going to create the FdEntry if the file exists.
uv_fs_t req;
uv_fs_t req = uv_fs_t();
auto cleanup = OnScopeLeave([&] { uv_fs_req_cleanup(&req); });
auto buf = std::make_shared<BufferValue>(env->isolate(), path);
@@ -849,7 +849,7 @@ class FdEntry final : public EntryImpl {
}
static bool CheckModified(FdEntry* entry, int fd) {
uv_fs_t req;
uv_fs_t req = uv_fs_t();
auto cleanup = OnScopeLeave([&] { uv_fs_req_cleanup(&req); });
// TODO(jasnell): Note the use of a sync fs call here is a bit unfortunate.
// Doing this asynchronously creates a bit of a race condition tho, a file
+1 -1
View File
@@ -75,7 +75,7 @@ int RunNodeInstance(MultiIsolatePlatform* platform,
if (snapshot_as_file_it != args.end()) {
snapshot = node::EmbedderSnapshotData::FromFile(fp);
} else {
uv_fs_t req;
uv_fs_t req = uv_fs_t();
int statret = uv_fs_stat(nullptr, &req, filename, nullptr);
assert(statret == 0);
size_t filesize = req.statbuf.st_size;