From d0a5e7e342bb7b69718565f952a24bc320fc428f Mon Sep 17 00:00:00 2001 From: Michael Dawson Date: Thu, 23 Mar 2023 15:53:16 -0400 Subject: [PATCH] src: fix some recently introduced coverity issues Signed-off-by: Michael Dawson PR-URL: https://github.com/nodejs/node/pull/47240 Reviewed-By: Richard Lau Reviewed-By: Luigi Pinca --- src/dataqueue/queue.cc | 4 ++-- test/embedding/embedtest.cc | 2 +- 2 files changed, 3 insertions(+), 3 deletions(-) diff --git a/src/dataqueue/queue.cc b/src/dataqueue/queue.cc index 260c70ebbf2d98..3eabf425339de5 100644 --- a/src/dataqueue/queue.cc +++ b/src/dataqueue/queue.cc @@ -787,7 +787,7 @@ class FdEntry final : public EntryImpl { public: static std::unique_ptr Create(Environment* env, Local 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(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 diff --git a/test/embedding/embedtest.cc b/test/embedding/embedtest.cc index bd639368acdf86..3592ccb9813228 100644 --- a/test/embedding/embedtest.cc +++ b/test/embedding/embedtest.cc @@ -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;