]> git-server-git.apps.pok.os.sepia.ceph.com Git - rocksdb.git/commitdiff
Fix the valgrind error in newly added unittests for table stats
authorKai Liu <hfevers@gmail.com>
Mon, 21 Oct 2013 05:02:05 +0000 (22:02 -0700)
committerKai Liu <hfevers@gmail.com>
Mon, 21 Oct 2013 05:02:05 +0000 (22:02 -0700)
Summary:

Previous the newly added test called NewBloomFilter without releasing it at the end of the test, which resulted in memory leak and was detected by valgrind.

Test Plan:

Ran valgrind test.

table/table_test.cc

index 066b7362ecaa758027d17058d92fe9d3519c6f67..5ed8c7070c11470d82cdba26884f8f16bcd9ba72 100644 (file)
@@ -906,7 +906,10 @@ TEST(TableTest, FilterPolicyNameStats) {
   std::vector<std::string> keys;
   KVMap kvmap;
   Options options;
-  options.filter_policy = NewBloomFilterPolicy(10);
+  std::unique_ptr<const FilterPolicy> filter_policy(
+    NewBloomFilterPolicy(10)
+  );
+  options.filter_policy = filter_policy.get();
 
   c.Finish(options, &keys, &kvmap);
   auto& stats = c.table()->GetTableStats();