this should fix the mmeory leak

This commit is contained in:
Robin Müller 2022-07-25 22:10:20 +02:00
parent 6d00fc65c0
commit c12669fe50
No known key found for this signature in database
GPG Key ID: 11D4952C8CCEF814
3 changed files with 19 additions and 13 deletions

View File

@ -209,9 +209,9 @@ ReturnValue_t LocalDataPoolManager::handleNotificationSnapshot(HkReceiver& recei
}
/* Prepare and send update snapshot */
timeval now;
timeval now{};
Clock::getClock_timeval(&now);
CCSDSTime::CDS_short cds;
CCSDSTime::CDS_short cds{};
CCSDSTime::convertToCcsds(&cds, &now);
HousekeepingSnapshot updatePacket(
reinterpret_cast<uint8_t*>(&cds), sizeof(cds),
@ -245,9 +245,9 @@ ReturnValue_t LocalDataPoolManager::handleNotificationSnapshot(HkReceiver& recei
}
/* Prepare and send update snapshot */
timeval now;
timeval now{};
Clock::getClock_timeval(&now);
CCSDSTime::CDS_short cds;
CCSDSTime::CDS_short cds{};
CCSDSTime::convertToCcsds(&cds, &now);
HousekeepingSnapshot updatePacket(
reinterpret_cast<uint8_t*>(&cds), sizeof(cds),
@ -291,8 +291,7 @@ ReturnValue_t LocalDataPoolManager::addUpdateToStore(HousekeepingSnapshot& updat
void LocalDataPoolManager::handleChangeResetLogic(DataType type, DataId dataId,
MarkChangedIF* toReset) {
HkUpdateResetList& listRef = hkUpdateResetList;
for (auto& changeInfo : listRef) {
for (auto& changeInfo : hkUpdateResetList) {
if (changeInfo.dataType != type) {
continue;
}

View File

@ -19,12 +19,12 @@ ReturnValue_t LocalPoolOwnerBase::initializeHkManager() {
ReturnValue_t LocalPoolOwnerBase::initializeLocalDataPool(localpool::DataPool &localDataPoolMap,
LocalDataPoolManager &poolManager) {
// Default initialization empty for now.
localDataPoolMap.emplace(lpool::uint8VarId, new PoolEntry<uint8_t>({0}));
localDataPoolMap.emplace(lpool::floatVarId, new PoolEntry<float>({0}));
localDataPoolMap.emplace(lpool::uint32VarId, new PoolEntry<uint32_t>({0}));
localDataPoolMap.emplace(lpool::uint8VarId, &u8PoolEntry);
localDataPoolMap.emplace(lpool::floatVarId, &floatPoolEntry);
localDataPoolMap.emplace(lpool::uint32VarId, &u32PoolEntry);
localDataPoolMap.emplace(lpool::uint16Vec3Id, new PoolEntry<uint16_t>({0, 0, 0}));
localDataPoolMap.emplace(lpool::int64Vec2Id, new PoolEntry<int64_t>({0, 0}));
localDataPoolMap.emplace(lpool::uint16Vec3Id, &u16VecPoolEntry);
localDataPoolMap.emplace(lpool::int64Vec2Id, &i64VecPoolEntry);
return HasReturnvaluesIF::RETURN_OK;
}

View File

@ -7,10 +7,12 @@
#include <fsfw/datapoollocal/LocalPoolVariable.h>
#include <fsfw/datapoollocal/LocalPoolVector.h>
#include <fsfw/datapoollocal/StaticLocalDataSet.h>
#include "fsfw/datapool/PoolEntry.h"
#include <fsfw/ipc/QueueFactory.h>
#include <fsfw/objectmanager/SystemObject.h>
#include "../mocks/MessageQueueMock.h"
#include "mocks/MessageQueueMock.h"
#include "tests/TestsConfig.h"
namespace lpool {
@ -164,10 +166,15 @@ class LocalPoolOwnerBase : public SystemObject, public HasLocalDataPoolIF {
gp_id_t changedPoolVariableGpid;
store_address_t storeIdForChangedVariable;
PoolEntry<uint8_t> u8PoolEntry = PoolEntry<uint8_t>({0});
PoolEntry<float> floatPoolEntry = PoolEntry<float>({0});
PoolEntry<uint32_t> u32PoolEntry = PoolEntry<uint32_t>({0});
PoolEntry<uint16_t> u16VecPoolEntry = PoolEntry<uint16_t>({0, 0, 0});
PoolEntry<int64_t> i64VecPoolEntry = PoolEntry<int64_t>({0, 0});
lp_var_t<uint8_t> testUint8 = lp_var_t<uint8_t>(this, lpool::uint8VarId);
lp_var_t<float> testFloat = lp_var_t<float>(this, lpool::floatVarId);
lp_var_t<uint32_t> testUint32 = lp_var_t<uint32_t>(this, lpool::uint32VarId);
lp_vec_t<uint16_t, 3> testUint16Vec = lp_vec_t<uint16_t, 3>(this, lpool::uint16Vec3Id);
lp_vec_t<int64_t, 2> testInt64Vec = lp_vec_t<int64_t, 2>(this, lpool::int64Vec2Id);