possible double delete

This commit is contained in:
Robin Müller 2022-07-25 22:36:53 +02:00
parent 747243684d
commit e48b6f1432
No known key found for this signature in database
GPG Key ID: 11D4952C8CCEF814
3 changed files with 5 additions and 7 deletions

View File

@ -9,8 +9,8 @@
class HealthTable : public HealthTableIF, public SystemObject { class HealthTable : public HealthTableIF, public SystemObject {
public: public:
HealthTable(object_id_t objectid); explicit HealthTable(object_id_t objectid);
virtual ~HealthTable(); ~HealthTable() override;
void setMutexTimeout(MutexIF::TimeoutType timeoutType, uint32_t timeoutMs); void setMutexTimeout(MutexIF::TimeoutType timeoutType, uint32_t timeoutMs);

View File

@ -21,7 +21,7 @@ void ObjectManager::setObjectFactoryFunction(produce_function_t objFactoryFunc,
this->factoryArgs = factoryArgs; this->factoryArgs = factoryArgs;
} }
ObjectManager::ObjectManager() {} ObjectManager::ObjectManager() = default;
ObjectManager::~ObjectManager() { ObjectManager::~ObjectManager() {
for (auto const& iter : objectList) { for (auto const& iter : objectList) {
@ -36,7 +36,7 @@ ReturnValue_t ObjectManager::insert(object_id_t id, SystemObjectIF* object) {
// sif::debug << "ObjectManager::insert: Object " << std::hex // sif::debug << "ObjectManager::insert: Object " << std::hex
// << (int)id << std::dec << " inserted." << std::endl; // << (int)id << std::dec << " inserted." << std::endl;
#endif #endif
return this->RETURN_OK; return HasReturnvaluesIF::RETURN_OK;
} else { } else {
#if FSFW_CPP_OSTREAM_ENABLED == 1 #if FSFW_CPP_OSTREAM_ENABLED == 1
sif::error << "ObjectManager::insert: Object ID " << std::hex << static_cast<uint32_t>(id) sif::error << "ObjectManager::insert: Object ID " << std::hex << static_cast<uint32_t>(id)
@ -53,7 +53,7 @@ ReturnValue_t ObjectManager::insert(object_id_t id, SystemObjectIF* object) {
} }
ReturnValue_t ObjectManager::remove(object_id_t id) { ReturnValue_t ObjectManager::remove(object_id_t id) {
if (this->getSystemObject(id) != NULL) { if (this->getSystemObject(id) != nullptr) {
this->objectList.erase(id); this->objectList.erase(id);
#if FSFW_CPP_OSTREAM_ENABLED == 1 #if FSFW_CPP_OSTREAM_ENABLED == 1
// sif::debug << "ObjectManager::removeObject: Object " << std::hex // sif::debug << "ObjectManager::removeObject: Object " << std::hex

View File

@ -31,7 +31,5 @@ int customSetup() {
} }
int customTeardown() { int customTeardown() {
ObjectManager* objMan = ObjectManager::instance();
delete objMan;
return 0; return 0;
} }