From 6356b4d516b504999d18e3de08ffe3f7533a6e3f Mon Sep 17 00:00:00 2001 From: Islam AbdelRahman Date: Tue, 19 Apr 2016 13:57:05 -0700 Subject: [PATCH] Fix nullptr dereference in adaptive_table Summary: @dulmarod Ran infer on RocksDB and found that we dereference nullptr in adaptive_table https://fb.facebook.com/groups/rocksdb/permalink/1046374415411173/ Test Plan: make check -j64 Reviewers: sdong, yhchiang, andrewkr Reviewed By: andrewkr Subscribers: andrewkr, dhruba Differential Revision: https://reviews.facebook.net/D56973 --- table/adaptive_table_factory.cc | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) diff --git a/table/adaptive_table_factory.cc b/table/adaptive_table_factory.cc index 3e2cfa326..67ccbec15 100644 --- a/table/adaptive_table_factory.cc +++ b/table/adaptive_table_factory.cc @@ -78,25 +78,25 @@ std::string AdaptiveTableFactory::GetPrintableTableOptions() const { const int kBufferSize = 200; char buffer[kBufferSize]; - if (!table_factory_to_write_) { + if (table_factory_to_write_) { snprintf(buffer, kBufferSize, " write factory (%s) options:\n%s\n", table_factory_to_write_->Name(), table_factory_to_write_->GetPrintableTableOptions().c_str()); ret.append(buffer); } - if (!plain_table_factory_) { + if (plain_table_factory_) { snprintf(buffer, kBufferSize, " %s options:\n%s\n", plain_table_factory_->Name(), plain_table_factory_->GetPrintableTableOptions().c_str()); ret.append(buffer); } - if (!block_based_table_factory_) { + if (block_based_table_factory_) { snprintf(buffer, kBufferSize, " %s options:\n%s\n", block_based_table_factory_->Name(), block_based_table_factory_->GetPrintableTableOptions().c_str()); ret.append(buffer); } - if (!cuckoo_table_factory_) { + if (cuckoo_table_factory_) { snprintf(buffer, kBufferSize, " %s options:\n%s\n", cuckoo_table_factory_->Name(), cuckoo_table_factory_->GetPrintableTableOptions().c_str());