Clock cache should check if deleter is nullptr before calling it

Summary:
Clock cache should check if deleter is nullptr before calling it.
Closes https://github.com/facebook/rocksdb/pull/3677

Differential Revision: D7493602

Pulled By: yiwu-arbug

fbshipit-source-id: 4f94b188d2baf2cbc7c0d5da30fea1215a683de4
main
Yi Wu 7 years ago committed by Facebook Github Bot
parent 147dfc7bdf
commit 685912d07f
  1. 4
      cache/clock_cache.cc

@ -367,7 +367,9 @@ ClockCacheShard::~ClockCacheShard() {
for (auto& handle : list_) {
uint32_t flags = handle.flags.load(std::memory_order_relaxed);
if (InCache(flags) || CountRefs(flags) > 0) {
(*handle.deleter)(handle.key, handle.value);
if (handle.deleter != nullptr) {
(*handle.deleter)(handle.key, handle.value);
}
delete[] handle.key.data();
}
}

Loading…
Cancel
Save