From 34a70859bcb74d20d0b5f265d4ffc2e8c7d3b2b4 Mon Sep 17 00:00:00 2001 From: Maysam Yabandeh Date: Fri, 24 Mar 2017 17:07:38 -0700 Subject: [PATCH] Fix segmentation fault caused by #1961 Summary: Fixes #1961 which causes a segfault when filter_policy is nullptr and both pin_l0_filter_and_index_blocks_in_cache/cache_index_and_filter_blocks are set. Closes https://github.com/facebook/rocksdb/pull/2029 Differential Revision: D4764862 Pulled By: maysamyabandeh fbshipit-source-id: 05bd695 --- table/block_based_table_reader.cc | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/table/block_based_table_reader.cc b/table/block_based_table_reader.cc index eebe91d6a..d9a6c18a6 100644 --- a/table/block_based_table_reader.cc +++ b/table/block_based_table_reader.cc @@ -732,7 +732,9 @@ Status BlockBasedTable::Open(const ImmutableCFOptions& ioptions, if (rep->table_options.pin_l0_filter_and_index_blocks_in_cache && level == 0) { rep->filter_entry = filter_entry; - rep->filter_entry.value->SetLevel(level); + if (rep->filter_entry.value != nullptr) { + rep->filter_entry.value->SetLevel(level); + } } else { filter_entry.Release(table_options.block_cache.get()); }