From 50e95a63dd853ffa1dbe190d9facb048a03eca52 Mon Sep 17 00:00:00 2001 From: Prashant D Date: Fri, 27 Oct 2017 11:19:31 -0700 Subject: [PATCH] Fix coverity issues column_family, compaction_db/iterator Summary: db/column_family.h : 79 ColumnFamilyHandleInternal() CID 1322806 (#1 of 1): Uninitialized pointer field (UNINIT_CTOR) 2. uninit_member: Non-static class member internal_cfd_ is not initialized in this constructor nor in any functions that it calls. 80 : ColumnFamilyHandleImpl(nullptr, nullptr, nullptr) {} db/compacted_db_impl.cc: 18CompactedDBImpl::CompactedDBImpl( 19 const DBOptions& options, const std::string& dbname) 20 : DBImpl(options, dbname) { 2. uninit_member: Non-static class member cfd_ is not initialized in this constructor nor in any functions that it calls. 4. uninit_member: Non-static class member version_ is not initialized in this constructor nor in any functions that it calls. CID 1396120 (#1 of 1): Uninitialized pointer field (UNINIT_CTOR) 6. uninit_member: Non-static class member user_comparator_ is not initialized in this constructor nor in any functions that it calls. 21} db/compaction_iterator.cc: 9. uninit_member: Non-static class member current_user_key_sequence_ is not initialized in this constructor nor in any functions that it calls. 11. uninit_member: Non-static class member current_user_key_snapshot_ is not initialized in this constructor nor in any functions that it calls. CID 1419855 (#1 of 1): Uninitialized scalar field (UNINIT_CTOR) 13. uninit_member: Non-static class member current_key_committed_ is not initialized in this constructor nor in any functions that it calls. Closes https://github.com/facebook/rocksdb/pull/3084 Differential Revision: D6172999 Pulled By: sagar0 fbshipit-source-id: 084d73393faf8022c01359cfb445807b6a782460 --- db/column_family.h | 2 +- db/compacted_db_impl.cc | 3 ++- db/compaction_iterator.cc | 5 ++++- 3 files changed, 7 insertions(+), 3 deletions(-) diff --git a/db/column_family.h b/db/column_family.h index 256b66dac..d7e6c24ae 100644 --- a/db/column_family.h +++ b/db/column_family.h @@ -77,7 +77,7 @@ class ColumnFamilyHandleImpl : public ColumnFamilyHandle { class ColumnFamilyHandleInternal : public ColumnFamilyHandleImpl { public: ColumnFamilyHandleInternal() - : ColumnFamilyHandleImpl(nullptr, nullptr, nullptr) {} + : ColumnFamilyHandleImpl(nullptr, nullptr, nullptr), internal_cfd_(nullptr) {} void SetCFD(ColumnFamilyData* _cfd) { internal_cfd_ = _cfd; } virtual ColumnFamilyData* cfd() const override { return internal_cfd_; } diff --git a/db/compacted_db_impl.cc b/db/compacted_db_impl.cc index 7cff496f2..8f44b08b8 100644 --- a/db/compacted_db_impl.cc +++ b/db/compacted_db_impl.cc @@ -17,7 +17,8 @@ extern bool SaveValue(void* arg, const ParsedInternalKey& parsed_key, CompactedDBImpl::CompactedDBImpl( const DBOptions& options, const std::string& dbname) - : DBImpl(options, dbname) { + : DBImpl(options, dbname), cfd_(nullptr), version_(nullptr), + user_comparator_(nullptr) { } CompactedDBImpl::~CompactedDBImpl() { diff --git a/db/compaction_iterator.cc b/db/compaction_iterator.cc index 6de962ab4..312df2c61 100644 --- a/db/compaction_iterator.cc +++ b/db/compaction_iterator.cc @@ -80,7 +80,10 @@ CompactionIterator::CompactionIterator( #endif // ROCKSDB_LITE shutting_down_(shutting_down), ignore_snapshots_(false), - merge_out_iter_(merge_helper_) { + current_user_key_sequence_(0), + current_user_key_snapshot_(0), + merge_out_iter_(merge_helper_), + current_key_committed_(false) { assert(compaction_filter_ == nullptr || compaction_ != nullptr); bottommost_level_ = compaction_ == nullptr ? false : compaction_->bottommost_level();