From: Mark Kogan Date: Mon, 9 Dec 2024 15:53:17 +0000 (+0000) Subject: rgw/d4n: fix valgrind Invalid Memory Read & Write X-Git-Tag: v20.3.0~8^2~10 X-Git-Url: http://git-server-git.apps.pok.os.sepia.ceph.com/?a=commitdiff_plain;h=2d29b1f4a029fe15a0f7a74b77f47018c60b960c;p=ceph.git rgw/d4n: fix valgrind Invalid Memory Read & Write Signed-off-by: Mark Kogan --- diff --git a/src/rgw/driver/d4n/d4n_policy.cc b/src/rgw/driver/d4n/d4n_policy.cc index 06f51cb72991..4928b74e328a 100644 --- a/src/rgw/driver/d4n/d4n_policy.cc +++ b/src/rgw/driver/d4n/d4n_policy.cc @@ -511,10 +511,10 @@ bool LFUDAPolicy::_erase(const DoutPrefixProvider* dpp, const std::string& key, weightSum -= ((p->second->localWeight < 0) ? 0 : p->second->localWeight); entries_heap.erase(p->second->handle); - entries_map.erase(p); delete p->second; p->second = nullptr; - + entries_map.erase(p); + return true; } @@ -533,9 +533,9 @@ bool LFUDAPolicy::erase_dirty_object(const DoutPrefixProvider* dpp, const std::s } object_heap.erase(p->second.first->handle); - o_entries_map.erase(p); delete p->second.first; p->second.first = nullptr; + o_entries_map.erase(p); state_cond.notify_one(); return true;