]> git.apps.os.sepia.ceph.com Git - ceph-ci.git/commitdiff
tools: fix SimplyPolicy memory leak
authorshangdehao1 <dehao.shang@intel.com>
Thu, 14 Mar 2019 19:23:28 +0000 (03:23 +0800)
committerYuan Zhou <yuan.zhou@intel.com>
Thu, 21 Mar 2019 16:16:31 +0000 (00:16 +0800)
Signed-off-by: Dehao Shang <dehao.shang@intel.com>
src/tools/immutable_object_cache/ObjectCacheStore.h
src/tools/immutable_object_cache/SimplePolicy.cc

index 6ef977827ec80ac71e9ef709731a815e55532567..42237719fe5faffb9ce711565fbfdd9a02ee9868 100644 (file)
@@ -57,6 +57,6 @@ class ObjectCacheStore {
   std::string m_cache_root_dir;
 };
 
-}  // namespace immutable_obje_cache
+}  // namespace immutable_obj_cache
 }  // ceph
 #endif  // CEPH_CACHE_OBJECT_CACHE_STORE_H
index bb76f95c32193a893ee9e2db8984c3ea00c56cf3..299676626cf16866fa8bbee5316e131ac96b61fe 100644 (file)
@@ -120,6 +120,7 @@ void SimplePolicy::update_status(std::string file_name,
 
     m_cache_map.erase(entry_it);
     inflight_ops--;
+    delete entry;
     return;
   }
 
@@ -134,6 +135,7 @@ void SimplePolicy::update_status(std::string file_name,
     m_promoted_lru.lru_remove(entry);
     m_cache_map.erase(entry_it);
     m_cache_size -= size;
+    delete entry;
     return;
   }
 }