Skip to content

Commit 0383048

Browse files
bnoordhuisMylesBorins
authored andcommitted
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: #12387 Reviewed-By: Daniel Bevenius <[email protected]> Reviewed-By: Michael Dawson <[email protected]> Reviewed-By: Colin Ihrig <[email protected]> Reviewed-By: Anna Henningsen <[email protected]> Reviewed-By: James M Snell <[email protected]>
1 parent f2467ed commit 0383048

File tree

1 file changed

+6
-1
lines changed

1 file changed

+6
-1
lines changed

test/cctest/node_test_fixture.h

+6-1
Original file line numberDiff line numberDiff line change
@@ -64,6 +64,10 @@ class NodeTestFixture : public ::testing::Test {
6464
ArrayBufferAllocator allocator_;
6565
v8::Isolate* isolate_;
6666

67+
~NodeTestFixture() {
68+
TearDown();
69+
}
70+
6771
virtual void SetUp() {
6872
platform_ = v8::platform::CreateDefaultPlatform();
6973
v8::V8::InitializePlatform(platform_);
@@ -73,13 +77,14 @@ class NodeTestFixture : public ::testing::Test {
7377
}
7478

7579
virtual void TearDown() {
80+
if (platform_ == nullptr) return;
7681
v8::V8::ShutdownPlatform();
7782
delete platform_;
7883
platform_ = nullptr;
7984
}
8085

8186
private:
82-
v8::Platform* platform_;
87+
v8::Platform* platform_ = nullptr;
8388
};
8489

8590
#endif // TEST_CCTEST_NODE_TEST_FIXTURE_H_

0 commit comments

Comments
 (0)