From: Danny Al-Gaaf Date: Mon, 13 May 2013 10:45:03 +0000 (+0200) Subject: filestore/test_idempotent_sequence.cc: fix FileStore leaks X-Git-Tag: v0.63~29^2~19 X-Git-Url: http://git-server-git.apps.pok.os.sepia.ceph.com/?a=commitdiff_plain;h=d8cb7dfc223d7dc37467f8e37a0eb8c8a0228a75;p=ceph.git 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 --- diff --git a/src/test/filestore/test_idempotent_sequence.cc b/src/test/filestore/test_idempotent_sequence.cc index 818a2554c352..d8f8c33ab516 100644 --- a/src/test/filestore/test_idempotent_sequence.cc +++ b/src/test/filestore/test_idempotent_sequence.cc @@ -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; }