Skip to content

Commit 6c912a8

Browse files
bnoordhuisjasnell
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 4fc1199 commit 6c912a8

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
@@ -79,6 +79,10 @@ class NodeTestFixture : public ::testing::Test {
7979
ArrayBufferAllocator allocator_;
8080
v8::Isolate* isolate_;
8181

82+
~NodeTestFixture() {
83+
TearDown();
84+
}
85+
8286
virtual void SetUp() {
8387
platform_ = v8::platform::CreateDefaultPlatform();
8488
v8::V8::InitializePlatform(platform_);
@@ -88,13 +92,14 @@ class NodeTestFixture : public ::testing::Test {
8892
}
8993

9094
virtual void TearDown() {
95+
if (platform_ == nullptr) return;
9196
v8::V8::ShutdownPlatform();
9297
delete platform_;
9398
platform_ = nullptr;
9499
}
95100

96101
private:
97-
v8::Platform* platform_;
102+
v8::Platform* platform_ = nullptr;
98103
};
99104

100105
#endif // TEST_CCTEST_NODE_TEST_FIXTURE_H_

0 commit comments

Comments
 (0)