Skip to content

Commit 398cf3a

Browse files
committed
test: initialize platform in NodeTestFixture
Calling TearDown() without Setup() first is not allowed, but this should fix a coverity warning: *** CID 166971: Uninitialized members (UNINIT_CTOR) /test/cctest/node_test_fixture.h: 97 in NodeTestFixture::NodeTestFixture()() 91 v8::V8::ShutdownPlatform(); 92 delete platform_; 93 platform_ = nullptr; 94 } 95 96 private: >>> CID 166971: Uninitialized members (UNINIT_CTOR) >>> The compiler-generated constructor for this class does not initialize "platform_". 97 v8::Platform* platform_; 98 };
1 parent 6724f78 commit 398cf3a

1 file changed

Lines changed: 4 additions & 0 deletions

File tree

test/cctest/node_test_fixture.h

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -79,6 +79,8 @@ class NodeTestFixture : public ::testing::Test {
7979
ArrayBufferAllocator allocator_;
8080
v8::Isolate* isolate_;
8181

82+
NodeTestFixture() : isolate_(nullptr), platform_(nullptr) {}
83+
8284
virtual void SetUp() {
8385
platform_ = v8::platform::CreateDefaultPlatform();
8486
v8::V8::InitializePlatform(platform_);
@@ -88,6 +90,8 @@ class NodeTestFixture : public ::testing::Test {
8890
}
8991

9092
virtual void TearDown() {
93+
isolate_->Dispose();
94+
isolate_ = nullptr;
9195
v8::V8::ShutdownPlatform();
9296
delete platform_;
9397
platform_ = nullptr;

0 commit comments

Comments
 (0)