From 65a5abab495ad07f5aca25f27569537fea6a577a Mon Sep 17 00:00:00 2001 From: Robin Mueller Date: Mon, 21 Nov 2022 14:56:08 +0100 Subject: [PATCH] move free call --- CMakeLists.txt | 12 +++++++++--- src/fsfw/storagemanager/StorageManagerIF.h | 3 ++- src/fsfw_hal/linux/serial/SerialCookie.cpp | 2 +- src/fsfw_hal/linux/serial/SerialCookie.h | 2 +- src/fsfw_hal/linux/uio/UioMapper.cpp | 6 +++--- unittests/hal/CMakeLists.txt | 4 +--- unittests/mocks/cfdp/FaultHandlerMock.h | 2 +- 7 files changed, 18 insertions(+), 13 deletions(-) diff --git a/CMakeLists.txt b/CMakeLists.txt index dd01510e..8308f523 100644 --- a/CMakeLists.txt +++ b/CMakeLists.txt @@ -346,9 +346,15 @@ if(FSFW_BUILD_TESTS) DEPENDENCIES ${FSFW_TEST_TGT}) else() setup_target_for_coverage_lcov( - NAME ${FSFW_TEST_TGT}_coverage EXECUTABLE ${FSFW_TEST_TGT} - DEPENDENCIES ${FSFW_TEST_TGT} - GENHTML_ARGS --html-epilog ${CMAKE_SOURCE_DIR}/unittests/lcov_epilog.html) + NAME + ${FSFW_TEST_TGT}_coverage + EXECUTABLE + ${FSFW_TEST_TGT} + DEPENDENCIES + ${FSFW_TEST_TGT} + GENHTML_ARGS + --html-epilog + ${CMAKE_SOURCE_DIR}/unittests/lcov_epilog.html) endif() endif() endif() diff --git a/src/fsfw/storagemanager/StorageManagerIF.h b/src/fsfw/storagemanager/StorageManagerIF.h index f9fb33f5..e48e19db 100644 --- a/src/fsfw/storagemanager/StorageManagerIF.h +++ b/src/fsfw/storagemanager/StorageManagerIF.h @@ -181,7 +181,8 @@ class StorageManagerIF { * @return Returns @returnvalue::OK if data was added. * @returnvalue::FAILED if data could not be added, storageId is unchanged then. */ - virtual ReturnValue_t getFreeElement(store_address_t* storageId, size_t size, uint8_t** dataPtr) = 0; + virtual ReturnValue_t getFreeElement(store_address_t* storageId, size_t size, + uint8_t** dataPtr) = 0; [[nodiscard]] virtual bool hasDataAtId(store_address_t storeId) const = 0; diff --git a/src/fsfw_hal/linux/serial/SerialCookie.cpp b/src/fsfw_hal/linux/serial/SerialCookie.cpp index e85d339d..1b7e9b51 100644 --- a/src/fsfw_hal/linux/serial/SerialCookie.cpp +++ b/src/fsfw_hal/linux/serial/SerialCookie.cpp @@ -3,7 +3,7 @@ #include SerialCookie::SerialCookie(object_id_t handlerId, std::string deviceFile, UartBaudRate baudrate, - size_t maxReplyLen, UartModes uartMode) + size_t maxReplyLen, UartModes uartMode) : handlerId(handlerId), deviceFile(deviceFile), uartMode(uartMode), diff --git a/src/fsfw_hal/linux/serial/SerialCookie.h b/src/fsfw_hal/linux/serial/SerialCookie.h index 3916e4ca..7a9c0eca 100644 --- a/src/fsfw_hal/linux/serial/SerialCookie.h +++ b/src/fsfw_hal/linux/serial/SerialCookie.h @@ -30,7 +30,7 @@ class SerialCookie : public CookieIF { * One stop bit */ SerialCookie(object_id_t handlerId, std::string deviceFile, UartBaudRate baudrate, - size_t maxReplyLen, UartModes uartMode = UartModes::NON_CANONICAL); + size_t maxReplyLen, UartModes uartMode = UartModes::NON_CANONICAL); virtual ~SerialCookie(); diff --git a/src/fsfw_hal/linux/uio/UioMapper.cpp b/src/fsfw_hal/linux/uio/UioMapper.cpp index e34c209a..9e16ce67 100644 --- a/src/fsfw_hal/linux/uio/UioMapper.cpp +++ b/src/fsfw_hal/linux/uio/UioMapper.cpp @@ -20,15 +20,15 @@ UioMapper::UioMapper(std::string uioFile, int mapNum) : mapNum(mapNum) { if (S_ISLNK(buf.st_mode)) { char* res = realpath(uioFile.c_str(), nullptr); if (res) { - this->uioFile = res; + uioFile = res; + free(res); } else { #if FSFW_CPP_OSTREAM_ENABLED == 1 sif::error << "Could not resolve real path of UIO file " << uioFile << std::endl; #endif } - free(res); } else { - this->uioFile = std::move(uioFile); + uioFile = std::move(uioFile); } } diff --git a/unittests/hal/CMakeLists.txt b/unittests/hal/CMakeLists.txt index 2a6c012b..76aabd51 100644 --- a/unittests/hal/CMakeLists.txt +++ b/unittests/hal/CMakeLists.txt @@ -1,7 +1,5 @@ target_sources(${FSFW_TEST_TGT} PRIVATE testHostFilesystem.cpp testFsMock.cpp) if(UNIX) - target_sources(${FSFW_TEST_TGT} PRIVATE - testCommandExecutor.cpp - ) + target_sources(${FSFW_TEST_TGT} PRIVATE testCommandExecutor.cpp) endif() diff --git a/unittests/mocks/cfdp/FaultHandlerMock.h b/unittests/mocks/cfdp/FaultHandlerMock.h index 1c59485c..5e094509 100644 --- a/unittests/mocks/cfdp/FaultHandlerMock.h +++ b/unittests/mocks/cfdp/FaultHandlerMock.h @@ -17,7 +17,7 @@ class FaultHandlerMock : public FaultHandlerBase { void noticeOfSuspensionCb(TransactionId& id, ConditionCode code) override; void noticeOfCancellationCb(TransactionId& id, ConditionCode code) override; - void abandonCb(TransactionId& id,ConditionCode code) override; + void abandonCb(TransactionId& id, ConditionCode code) override; void ignoreCb(TransactionId& id, ConditionCode code) override; FaultInfo& getFhInfo(FaultHandlerCode fhCode);