From 42be835e054b46bb3b3cfb0683ca51cb86b5f1f7 Mon Sep 17 00:00:00 2001 From: Eugene Ostroukhov Date: Fri, 7 Apr 2017 08:44:18 -0700 Subject: [PATCH] inspector: fix Coverity defects PR-URL: https://github.com/nodejs/node/pull/12272 Reviewed-By: Anna Henningsen Reviewed-By: James M Snell Reviewed-By: Ben Noordhuis --- src/inspector_io.cc | 8 ++++++-- 1 file changed, 6 insertions(+), 2 deletions(-) diff --git a/src/inspector_io.cc b/src/inspector_io.cc index dfb119e996c8f9..613e2f70c253f0 100644 --- a/src/inspector_io.cc +++ b/src/inspector_io.cc @@ -155,7 +155,7 @@ class DispatchOnInspectorBackendTask : public v8::Task { InspectorIo::InspectorIo(Environment* env, v8::Platform* platform, const std::string& path, const DebugOptions& options) - : options_(options), delegate_(nullptr), + : options_(options), thread_(), delegate_(nullptr), shutting_down_(false), state_(State::kNew), parent_env_(env), io_thread_req_(), platform_(platform), dispatching_messages_(false), @@ -236,6 +236,7 @@ void InspectorIo::WriteCbIO(uv_async_t* async) { template void InspectorIo::WorkerRunIO() { uv_loop_t loop; + loop.data = nullptr; int err = uv_loop_init(&loop); CHECK_EQ(err, 0); io_thread_req_.data = nullptr; @@ -244,8 +245,11 @@ void InspectorIo::WorkerRunIO() { std::string script_path; if (!script_name_.empty()) { uv_fs_t req; - if (0 == uv_fs_realpath(&loop, &req, script_name_.c_str(), nullptr)) + req.ptr = nullptr; + if (0 == uv_fs_realpath(&loop, &req, script_name_.c_str(), nullptr)) { + CHECK_NE(req.ptr, nullptr); script_path = std::string(static_cast(req.ptr)); + } uv_fs_req_cleanup(&req); } InspectorIoDelegate delegate(this, script_path, script_name_,