From 718fc15831a2cb4eb91ed2aa2f694b47329f9189 Mon Sep 17 00:00:00 2001 From: Josh Durgin Date: Mon, 25 Sep 2017 19:33:31 -0700 Subject: [PATCH] tools/ceph-kvstore-tool: clean up destination store object If left alive, background threads in the db may crash Signed-off-by: Josh Durgin --- src/tools/ceph_kvstore_tool.cc | 6 ++++-- 1 file changed, 4 insertions(+), 2 deletions(-) diff --git a/src/tools/ceph_kvstore_tool.cc b/src/tools/ceph_kvstore_tool.cc index 84bb65b0034..bc888d7c051 100644 --- a/src/tools/ceph_kvstore_tool.cc +++ b/src/tools/ceph_kvstore_tool.cc @@ -197,10 +197,12 @@ class StoreTool } // open or create a leveldb store at @p other_path - KeyValueDB *other = KeyValueDB::create(g_ceph_context, other_type, other_path); - int err = other->create_and_open(std::cerr); + boost::scoped_ptr other; + KeyValueDB *other_ptr = KeyValueDB::create(g_ceph_context, other_type, other_path); + int err = other_ptr->create_and_open(std::cerr); if (err < 0) return err; + other.reset(other_ptr); KeyValueDB::WholeSpaceIterator it = db->get_iterator(); it->seek_to_first(); -- 2.39.5