Reset size_ to 0 in PinnableSlice::Reset (#4962)

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: https://github.com/facebook/rocksdb/pull/4962

Differential Revision: D14012710

Pulled By: maysamyabandeh

fbshipit-source-id: 23f4e173386b5461fd5650f44cde470805f4e816
This commit is contained in:
Maysam Yabandeh 2019-02-08 15:29:19 -08:00 committed by Facebook Github Bot
parent 1a761e6a6c
commit 39fb88f14e

View File

@ -202,6 +202,7 @@ class PinnableSlice : public Slice, public Cleanable {
void Reset() {
Cleanable::Reset();
pinned_ = false;
size_ = 0;
}
inline std::string* GetSelf() { return buf_; }
@ -255,4 +256,4 @@ inline size_t Slice::difference_offset(const Slice& b) const {
return off;
}
} // namespace rocksdb
} // namespace rocksdb