Skip to content
Snippets Groups Projects
Commit 313d26d2 authored by Cedric CAFFY's avatar Cedric CAFFY
Browse files

Corrected the memory leak in OStoreDBTest and SchedulerDatabaseTest

parent 7d68ef3f
Branches
Tags
No related merge requests found
...@@ -32,7 +32,6 @@ namespace catalogue { ...@@ -32,7 +32,6 @@ namespace catalogue {
class DummyCatalogue: public Catalogue { class DummyCatalogue: public Catalogue {
public: public:
DummyCatalogue() {} DummyCatalogue() {}
DummyCatalogue(const cta::catalogue::DummyCatalogue*) {}
virtual ~DummyCatalogue() { } virtual ~DummyCatalogue() { }
void createActivitiesFairShareWeight(const common::dataStructures::SecurityIdentity& admin, const std::string& diskInstanceName, const std::string& acttivity, double weight, const std::string & comment) override { throw exception::Exception(std::string("In ")+__PRETTY_FUNCTION__+": not implemented"); } void createActivitiesFairShareWeight(const common::dataStructures::SecurityIdentity& admin, const std::string& diskInstanceName, const std::string& acttivity, double weight, const std::string & comment) override { throw exception::Exception(std::string("In ")+__PRETTY_FUNCTION__+": not implemented"); }
......
...@@ -64,7 +64,7 @@ public: ...@@ -64,7 +64,7 @@ public:
// We do a deep reference to the member as the C++ compiler requires the function to be // We do a deep reference to the member as the C++ compiler requires the function to be
// already defined if called implicitly. // already defined if called implicitly.
const auto &factory = GetParam().dbFactory; const auto &factory = GetParam().dbFactory;
m_catalogue = cta::make_unique<cta::catalogue::DummyCatalogue>(new cta::catalogue::DummyCatalogue); m_catalogue = cta::make_unique<cta::catalogue::DummyCatalogue>();
// Get the OStore DB from the factory. // Get the OStore DB from the factory.
auto osdb = std::move(factory.create(m_catalogue)); auto osdb = std::move(factory.create(m_catalogue));
// Make sure the type of the SchedulerDatabase is correct (it should be an OStoreDBWrapperInterface). // Make sure the type of the SchedulerDatabase is correct (it should be an OStoreDBWrapperInterface).
...@@ -75,6 +75,7 @@ public: ...@@ -75,6 +75,7 @@ public:
virtual void TearDown() { virtual void TearDown() {
m_db.reset(); m_db.reset();
m_catalogue.reset();
} }
cta::objectstore::OStoreDBWrapperInterface &getDb() { cta::objectstore::OStoreDBWrapperInterface &getDb() {
......
...@@ -72,12 +72,13 @@ public: ...@@ -72,12 +72,13 @@ public:
using namespace cta; using namespace cta;
const SchedulerDatabaseFactory &factory = GetParam().dbFactory; const SchedulerDatabaseFactory &factory = GetParam().dbFactory;
m_catalogue = cta::make_unique<cta::catalogue::DummyCatalogue>(new cta::catalogue::DummyCatalogue); m_catalogue = cta::make_unique<cta::catalogue::DummyCatalogue>();
m_db.reset(factory.create(m_catalogue).release()); m_db.reset(factory.create(m_catalogue).release());
} }
virtual void TearDown() { virtual void TearDown() {
m_db.reset(); m_db.reset();
m_catalogue.reset();
} }
cta::SchedulerDatabase &getDb() { cta::SchedulerDatabase &getDb() {
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Please register or to comment