From 6c912a8216e70bca089f581c32dd58764adefe74 Mon Sep 17 00:00:00 2001 From: Ben Noordhuis Date: Thu, 13 Apr 2017 12:34:19 +0200 Subject: [PATCH] test: fix coverity UNINIT_CTOR cctest warning Explicitly initialize `platform_` to nullptr. Coverity cannot divine it is set and cleared by the Setup() and TearDown() methods. PR-URL: https://github.com/nodejs/node/pull/12387 Reviewed-By: Daniel Bevenius Reviewed-By: Michael Dawson Reviewed-By: Colin Ihrig Reviewed-By: Anna Henningsen Reviewed-By: James M Snell --- test/cctest/node_test_fixture.h | 7 ++++++- 1 file changed, 6 insertions(+), 1 deletion(-) diff --git a/test/cctest/node_test_fixture.h b/test/cctest/node_test_fixture.h index bf155c58945582..f5a25c70b5f44c 100644 --- a/test/cctest/node_test_fixture.h +++ b/test/cctest/node_test_fixture.h @@ -79,6 +79,10 @@ class NodeTestFixture : public ::testing::Test { ArrayBufferAllocator allocator_; v8::Isolate* isolate_; + ~NodeTestFixture() { + TearDown(); + } + virtual void SetUp() { platform_ = v8::platform::CreateDefaultPlatform(); v8::V8::InitializePlatform(platform_); @@ -88,13 +92,14 @@ class NodeTestFixture : public ::testing::Test { } virtual void TearDown() { + if (platform_ == nullptr) return; v8::V8::ShutdownPlatform(); delete platform_; platform_ = nullptr; } private: - v8::Platform* platform_; + v8::Platform* platform_ = nullptr; }; #endif // TEST_CCTEST_NODE_TEST_FIXTURE_H_