Skip to content

Commit

Permalink
Reset size_ to 0 in PinnableSlice::Reset (facebook#4962)
Browse files Browse the repository at this point in the history
Summary:
It would avoid bugs if the reused PinnableSlice is not actually reassigned and yet the programmer makes conclusions based on the size of the Slice.
Pull Request resolved: facebook#4962

Differential Revision: D14012710

Pulled By: maysamyabandeh

fbshipit-source-id: 23f4e173386b5461fd5650f44cde470805f4e816
  • Loading branch information
Maysam Yabandeh authored and facebook-github-bot committed Feb 9, 2019
1 parent 1a761e6 commit 39fb88f
Showing 1 changed file with 2 additions and 1 deletion.
3 changes: 2 additions & 1 deletion include/rocksdb/slice.h
Original file line number Diff line number Diff line change
Expand Up @@ -202,6 +202,7 @@ class PinnableSlice : public Slice, public Cleanable {
void Reset() {
Cleanable::Reset();
pinned_ = false;
size_ = 0;
}

inline std::string* GetSelf() { return buf_; }
Expand Down Expand Up @@ -255,4 +256,4 @@ inline size_t Slice::difference_offset(const Slice& b) const {
return off;
}

} // namespace rocksdb
} // namespace rocksdb

0 comments on commit 39fb88f

Please sign in to comment.