mirror of
https://github.com/ceph/ceph
synced 2024-12-18 09:25:49 +00:00
filestore/test_idempotent_sequence.cc: fix FileStore leaks
CID 717107 (#1 of 1): Resource leak (RESOURCE_LEAK) leaked_storage: Variable "store" going out of scope leaks the storage it points to. Signed-off-by: Danny Al-Gaaf <danny.al-gaaf@bisect.de>
This commit is contained in:
parent
349cfb41d0
commit
d8cb7dfc22
@ -91,6 +91,8 @@ int run_diff(std::string& a_path, std::string& a_journal,
|
||||
dout(0) << "no diff" << dendl;
|
||||
}
|
||||
|
||||
delete a;
|
||||
delete b;
|
||||
return ret;
|
||||
}
|
||||
|
||||
@ -99,8 +101,10 @@ int run_get_last_op(std::string& filestore_path, std::string& journal_path)
|
||||
FileStore *store = new FileStore(filestore_path, journal_path);
|
||||
|
||||
int err = store->mount();
|
||||
if (err)
|
||||
if (err) {
|
||||
delete store;
|
||||
return err;
|
||||
}
|
||||
|
||||
coll_t txn_coll("meta");
|
||||
hobject_t txn_object(sobject_t("txn", CEPH_NOSNAP));
|
||||
@ -135,6 +139,7 @@ int run_sequence_to(int val, std::string& filestore_path,
|
||||
err = ::mkdir(filestore_path.c_str(), 0755);
|
||||
if (err) {
|
||||
cerr << filestore_path << " already exists" << std::endl;
|
||||
delete store;
|
||||
return err;
|
||||
}
|
||||
|
||||
@ -149,6 +154,7 @@ int run_sequence_to(int val, std::string& filestore_path,
|
||||
op_sequence.generate(seed, num_txs);
|
||||
store->umount();
|
||||
|
||||
delete store;
|
||||
return 0;
|
||||
}
|
||||
|
||||
|
Loading…
Reference in New Issue
Block a user