From 73e6ffc9366926ad8a0d392dc2bf8a9e6728b723 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 (cherry picked from commit 718fc15831a2cb4eb91ed2aa2f694b47329f9189) --- 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 1a9af24108b40..b8ce4563132ab 100644 --- a/src/tools/ceph_kvstore_tool.cc +++ b/src/tools/ceph_kvstore_tool.cc @@ -150,10 +150,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