From 16d4e45c1295bd2f024e9cf65b4b6c18314694cf Mon Sep 17 00:00:00 2001 From: Kai Liu Date: Sat, 1 Mar 2014 11:50:35 -0800 Subject: [PATCH] Fix the memory leak in table index Summary: BinarySearchIndex didn't use unique_ptr to guard the block object nor delete it in destructor, leading to valgrind failure for "definite memory leak". Test Plan: re-ran the failed valgrind test cases --- table/block_based_table_reader.cc | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/table/block_based_table_reader.cc b/table/block_based_table_reader.cc index 4fb7c308a..c3e48c42b 100644 --- a/table/block_based_table_reader.cc +++ b/table/block_based_table_reader.cc @@ -181,7 +181,7 @@ class BinarySearchIndexReader : public IndexReader { : IndexReader(comparator), index_block_(index_block) { assert(index_block_ != nullptr); } - Block* index_block_; + std::unique_ptr index_block_; }; // TODO(kailiu) This class is only a stub for now. And the comment below is also