Skip to content

Commit

Permalink
Merge pull request #42535 from miretskiy/backport19.2-42529
Browse files Browse the repository at this point in the history
release-19.2: libroach: Fix memory leak in row_counter
  • Loading branch information
miretskiy authored Nov 18, 2019
2 parents c2b2cd1 + 2fc0740 commit 53eef08
Show file tree
Hide file tree
Showing 2 changed files with 5 additions and 3 deletions.
6 changes: 4 additions & 2 deletions c-deps/libroach/row_counter.cc
Original file line number Diff line number Diff line change
Expand Up @@ -88,10 +88,12 @@ bool RowCounter::Count(const rocksdb::Slice& key, cockroach::roachpb::BulkOpSumm
}

// no change key prefix => no new row.
if (decoded_key.data() == prev_key.data) {
if (decoded_key == prev_key) {
return true;
}
prev_key = ToDBString(decoded_key);


prev_key.assign(decoded_key.data(), decoded_key.size());

uint64_t tbl;
if (!DecodeTablePrefix(&decoded_key, &tbl)) {
Expand Down
2 changes: 1 addition & 1 deletion c-deps/libroach/row_counter.h
Original file line number Diff line number Diff line change
Expand Up @@ -29,6 +29,6 @@ struct RowCounter {
private:
void EnsureSafeSplitKey(rocksdb::Slice* key);
int GetRowPrefixLength(rocksdb::Slice* key);
DBString prev_key;
std::string prev_key;
rocksdb::Slice prev;
};

0 comments on commit 53eef08

Please sign in to comment.