]> git-server-git.apps.pok.os.sepia.ceph.com Git - ceph.git/commitdiff
rgw/d4n: fix valgrind Invalid Memory Read & Write
authorMark Kogan <mkogan@redhat.com>
Mon, 9 Dec 2024 15:53:17 +0000 (15:53 +0000)
committerPritha Srivastava <prsrivas@redhat.com>
Mon, 21 Apr 2025 04:04:07 +0000 (09:34 +0530)
Signed-off-by: Mark Kogan <mkogan@redhat.com>
src/rgw/driver/d4n/d4n_policy.cc

index 06f51cb729916f83d4da004dd8b044a383ffbb7c..4928b74e328abf0311ad615a0987568b4f7dac60 100644 (file)
@@ -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;