Fix memory leak in ColumnFamilyTest.WriteStall*

Summary: ColumnFamilyTest.WriteStallSingleColumnFamily and ColumnFamilyTest.WriteStallTwoColumnFamilies didn't clean up test state cleanly, causing memory leak. Fix it.

Test Plan: Run the two tests in valgrind and make sure they now pass.

Reviewers: yhchiang, anthony, rven, kradhakrishnan, IslamAbdelRahman

Reviewed By: IslamAbdelRahman

Subscribers: leveldb, dhruba

Differential Revision: https://reviews.facebook.net/D52347
main
sdong 9 years ago
parent b99d4276f2
commit fcafac053f
  1. 11
      db/column_family_test.cc

@ -63,6 +63,8 @@ class ColumnFamilyTest : public testing::Test {
}
~ColumnFamilyTest() {
Close();
Destroy();
delete env_;
}
@ -133,13 +135,7 @@ class ColumnFamilyTest : public testing::Test {
}
void Destroy() {
for (auto h : handles_) {
delete h;
}
handles_.clear();
names_.clear();
delete db_;
db_ = nullptr;
Close();
ASSERT_OK(DestroyDB(dbname_, Options(db_options_, column_family_options_)));
}
@ -2311,7 +2307,6 @@ TEST_F(ColumnFamilyTest, WriteStallSingleColumnFamily) {
ASSERT_TRUE(dbfull()->TEST_write_controler().NeedsDelay());
ASSERT_EQ(kBaseRate / 1.2,
dbfull()->TEST_write_controler().delayed_write_rate());
Close();
}
TEST_F(ColumnFamilyTest, WriteStallTwoColumnFamilies) {

Loading…
Cancel
Save