]> git-server-git.apps.pok.os.sepia.ceph.com Git - ceph.git/commitdiff
tools/ceph-kvstore-tool: clean up destination store object 18029/head
authorJosh Durgin <jdurgin@redhat.com>
Tue, 26 Sep 2017 02:33:31 +0000 (19:33 -0700)
committerJosh Durgin <jdurgin@redhat.com>
Thu, 28 Sep 2017 22:24:41 +0000 (18:24 -0400)
If left alive, background threads in the db may crash

Signed-off-by: Josh Durgin <jdurgin@redhat.com>
src/tools/ceph_kvstore_tool.cc

index 84bb65b00341cfe5fe933d81c10e21877a76b016..bc888d7c051f383964dd7cf35d794b3404874def 100644 (file)
@@ -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<KeyValueDB> 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();