Fix valgrind_check problem of simple_table_db_test.cc

Summary: Two memory issues caused valgrind_check to fail on simple_table_db_test. Fix it

Test Plan: make -j32 valgrind_check

Reviewers: kailiu, haobo, dhruba

Reviewed By: haobo

CC: leveldb

Differential Revision: https://reviews.facebook.net/D13773
main
Siying Dong 11 years ago
parent 79d8dad331
commit 068a819ac9
  1. 7
      db/simple_table_db_test.cc

@ -313,9 +313,9 @@ SimpleTableIterator::SimpleTableIterator(SimpleTable* table) :
}
SimpleTableIterator::~SimpleTableIterator() {
delete key_str_;
delete[] key_str_;
if (value_str_len_ >= 0) {
delete value_str_;
delete[] value_str_;
}
}
@ -361,12 +361,11 @@ void SimpleTableIterator::Next() {
Slice value_slice;
if ((int) value_size > value_str_len_) {
if (value_str_len_ >= 0) {
delete value_str_;
delete[] value_str_;
}
value_str_ = new char[value_size];
value_str_len_ = value_size;
}
char* value_str_ = new char[value_size];
s = table_->rep_->file->Read(next_offset_, value_size, &value_slice,
value_str_);
next_offset_ += value_size;

Loading…
Cancel
Save