Skip to content

Commit

Permalink
src: fix some recently introduced coverity issues
Browse files Browse the repository at this point in the history
Signed-off-by: Michael Dawson <mdawson@devrus.com>

PR-URL: #47240
Reviewed-By: Richard Lau <rlau@redhat.com>
Reviewed-By: Luigi Pinca <luigipinca@gmail.com>
  • Loading branch information
mhdawson authored and RafaelGSS committed Apr 7, 2023
1 parent bd4697a commit d0a5e7e
Show file tree
Hide file tree
Showing 2 changed files with 3 additions and 3 deletions.
4 changes: 2 additions & 2 deletions src/dataqueue/queue.cc
Original file line number Diff line number Diff line change
Expand Up @@ -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);
Expand Down Expand Up @@ -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
Expand Down
2 changes: 1 addition & 1 deletion test/embedding/embedtest.cc
Original file line number Diff line number Diff line change
Expand Up @@ -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;
Expand Down

0 comments on commit d0a5e7e

Please sign in to comment.