From 9439ccfc27bdbab0750c8bf7087c51778b242353 Mon Sep 17 00:00:00 2001 From: Prashant D Date: Mon, 30 Oct 2017 07:59:31 -0400 Subject: [PATCH] Fix coverity issues compaction_job, compaction_picker Summary: db/compaction_job.cc: ReportStartedCompaction(compaction); CID 1419863 (#1 of 1): Uninitialized scalar field (UNINIT_CTOR) 2. uninit_member: Non-static class member bottommost_level_ is not initialized in this constructor nor in any functions that it calls. db/compaction_picker_universal.cc: 7struct InputFileInfo { 2. uninit_member: Non-static class member level is not initialized in this constructor nor in any functions that it calls. CID 1405355 (#1 of 1): Uninitialized scalar field (UNINIT_CTOR) 4. uninit_member: Non-static class member index is not initialized in this constructor nor in any functions that it calls. 38 InputFileInfo() : f(nullptr) {} --- db/compaction_job.cc | 1 + db/compaction_picker_universal.cc | 2 +- db/dbformat.h | 2 +- 3 files changed, 3 insertions(+), 2 deletions(-) diff --git a/db/compaction_job.cc b/db/compaction_job.cc index 4754b6be410..9993006b848 100644 --- a/db/compaction_job.cc +++ b/db/compaction_job.cc @@ -293,6 +293,7 @@ CompactionJob::CompactionJob( snapshot_checker_(snapshot_checker), table_cache_(std::move(table_cache)), event_logger_(event_logger), + bottommost_level_(false), paranoid_file_checks_(paranoid_file_checks), measure_io_stats_(measure_io_stats) { assert(log_buffer_ != nullptr); diff --git a/db/compaction_picker_universal.cc b/db/compaction_picker_universal.cc index 14533fbcdd2..29632b7457f 100644 --- a/db/compaction_picker_universal.cc +++ b/db/compaction_picker_universal.cc @@ -35,7 +35,7 @@ namespace { // and the index of the file in that level struct InputFileInfo { - InputFileInfo() : f(nullptr) {} + InputFileInfo() : f(nullptr), level(0), index(0) {} FileMetaData* f; size_t level; diff --git a/db/dbformat.h b/db/dbformat.h index d3fa71c7ddb..acd7f9ac657 100644 --- a/db/dbformat.h +++ b/db/dbformat.h @@ -82,7 +82,7 @@ struct ParsedInternalKey { ParsedInternalKey() : sequence(kMaxSequenceNumber) // Make code analyzer happy - {} // Intentionally left uninitialized (for speed) + {} // Intentionally left uninitialized (for speed) ParsedInternalKey(const Slice& u, const SequenceNumber& seq, ValueType t) : user_key(u), sequence(seq), type(t) { } std::string DebugString(bool hex = false) const;