From: Josh Durgin Date: Tue, 26 Sep 2017 02:33:31 +0000 (-0700) Subject: tools/ceph-kvstore-tool: clean up destination store object X-Git-Tag: v10.2.11~32^2~3 X-Git-Url: http://git.apps.os.sepia.ceph.com/?a=commitdiff_plain;h=73e6ffc9366926ad8a0d392dc2bf8a9e6728b723;p=ceph.git 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) --- 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();