Skip to content

Commit

Permalink
Fix bugs detected by clang analyzer (facebook#5185)
Browse files Browse the repository at this point in the history
Summary:
as titled. False positive included, fixed anyway to make the check
pass.
Pull Request resolved: facebook#5185

Differential Revision: D14909384

Pulled By: riversand963

fbshipit-source-id: dc5177e72b1929ccfd6175a60e2cd7bdb9bd80f3
  • Loading branch information
riversand963 authored and facebook-github-bot committed Apr 12, 2019
1 parent f49e12b commit 3189398
Show file tree
Hide file tree
Showing 3 changed files with 3 additions and 1 deletion.
1 change: 1 addition & 0 deletions db/db_basic_test.cc
Original file line number Diff line number Diff line change
Expand Up @@ -1174,6 +1174,7 @@ TEST_F(DBBasicTest, MultiGetBatchedMultiLevel) {
Flush();
num_keys = 0;
}
ASSERT_EQ(0, num_keys);

for (int i = 0; i < 128; i += 9) {
ASSERT_OK(Put("key_" + std::to_string(i), "val_mem_" + std::to_string(i)));
Expand Down
2 changes: 1 addition & 1 deletion table/full_filter_block.cc
Original file line number Diff line number Diff line change
Expand Up @@ -196,7 +196,7 @@ void FullFilterBlockReader::MayMatch(MultiGetRange* range) {
// declare both keys and may_match as arrays, which is also slightly less
// expensive compared to autovector
Slice* keys[MultiGetContext::MAX_BATCH_SIZE];
bool may_match[MultiGetContext::MAX_BATCH_SIZE];
bool may_match[MultiGetContext::MAX_BATCH_SIZE] = {false};
int num_keys = 0;
for (auto iter = range->begin(); iter != range->end(); ++iter) {
keys[num_keys++] = &iter->ukey;
Expand Down
1 change: 1 addition & 0 deletions tools/db_bench_tool.cc
Original file line number Diff line number Diff line change
Expand Up @@ -4618,6 +4618,7 @@ void VerifyDBFromDB(std::string& truth_db_name) {
std::vector<std::unique_ptr<const char[]> > key_guards;
std::vector<std::string> values(entries_per_batch_);
PinnableSlice* pin_values = new PinnableSlice[entries_per_batch_];
std::unique_ptr<PinnableSlice[]> pin_values_guard(pin_values);
std::vector<Status> stat_list(entries_per_batch_);
while (static_cast<int64_t>(keys.size()) < entries_per_batch_) {
key_guards.push_back(std::unique_ptr<const char[]>());
Expand Down

0 comments on commit 3189398

Please sign in to comment.