diff --git a/src/fsfw/datapool/PoolEntry.cpp b/src/fsfw/datapool/PoolEntry.cpp index d8e1d6344..7e922bcb2 100644 --- a/src/fsfw/datapool/PoolEntry.cpp +++ b/src/fsfw/datapool/PoolEntry.cpp @@ -8,17 +8,15 @@ template PoolEntry::PoolEntry(uint8_t len, bool setValid): length(len), valid(setValid) { - this->address = new T[this->length]; + this->address = new T[this->length](); std::memset(this->address, 0, this->getByteSize()); } template PoolEntry::PoolEntry(std::initializer_list initValues, bool setValid) : length(static_cast(initValues.size())), valid(setValid) { - this->address = new T[this->length]; - if (initValues.size() == 0) { - std::memset(this->address, 0, this->getByteSize()); - } else { + this->address = new T[this->length](); + if (initValues.size() > 0) { std::copy(initValues.begin(), initValues.end(), this->address); } } @@ -26,11 +24,9 @@ PoolEntry::PoolEntry(std::initializer_list initValues, bool setValid) template PoolEntry::PoolEntry(T* initValue, uint8_t setLength, bool setValid) : length(setLength), valid(setValid) { - this->address = new T[this->length]; + this->address = new T[this->length](); if (initValue != nullptr) { std::memcpy(this->address, initValue, this->getByteSize()); - } else { - std::memset(this->address, 0, this->getByteSize()); } }