From 359aca1c1235b0ce1b5b9592c4a579ecdd8a9c04 Mon Sep 17 00:00:00 2001 From: Alex Campbell Date: Tue, 10 Aug 2021 13:33:34 -0400 Subject: [PATCH 1/2] Fix #1776, Delete pools to stop memory leak. --- modules/cfe_testcase/src/es_mempool_test.c | 2 ++ 1 file changed, 2 insertions(+) diff --git a/modules/cfe_testcase/src/es_mempool_test.c b/modules/cfe_testcase/src/es_mempool_test.c index f6542eaf6..aad827443 100644 --- a/modules/cfe_testcase/src/es_mempool_test.c +++ b/modules/cfe_testcase/src/es_mempool_test.c @@ -44,11 +44,13 @@ void TestMemPoolCreate(void) UtAssert_INT32_EQ(CFE_ES_PoolCreateNoSem(NULL, Pool, sizeof(Pool)), CFE_ES_BAD_ARGUMENT); UtAssert_INT32_EQ(CFE_ES_PoolCreateNoSem(&PoolID, NULL, sizeof(Pool)), CFE_ES_BAD_ARGUMENT); UtAssert_INT32_EQ(CFE_ES_PoolCreateNoSem(&PoolID, Pool, 0), CFE_ES_BAD_ARGUMENT); + UtAssert_INT32_EQ(CFE_ES_PoolDelete(PoolID), CFE_SUCCESS); UtAssert_INT32_EQ(CFE_ES_PoolCreate(&PoolID, Pool, sizeof(Pool)), CFE_SUCCESS); UtAssert_INT32_EQ(CFE_ES_PoolCreate(NULL, Pool, sizeof(Pool)), CFE_ES_BAD_ARGUMENT); UtAssert_INT32_EQ(CFE_ES_PoolCreate(&PoolID, NULL, sizeof(Pool)), CFE_ES_BAD_ARGUMENT); UtAssert_INT32_EQ(CFE_ES_PoolCreate(&PoolID, Pool, 0), CFE_ES_BAD_ARGUMENT); + UtAssert_INT32_EQ(CFE_ES_PoolDelete(PoolID), CFE_SUCCESS); UtAssert_INT32_EQ(CFE_ES_PoolCreateEx(&PoolID, Pool, sizeof(Pool), 0, NULL, CFE_ES_NO_MUTEX), CFE_SUCCESS); UtAssert_INT32_EQ(CFE_ES_PoolCreateEx(NULL, Pool, sizeof(Pool), 0, NULL, CFE_ES_NO_MUTEX), CFE_ES_BAD_ARGUMENT); From d767a4ee299f84ed2f2332d3e4207f2359cfd1ee Mon Sep 17 00:00:00 2001 From: Alex Campbell Date: Tue, 10 Aug 2021 13:46:20 -0400 Subject: [PATCH 2/2] Fix #1770, Add Test for different CDS size. --- modules/cfe_testcase/src/es_cds_test.c | 12 +++++++----- 1 file changed, 7 insertions(+), 5 deletions(-) diff --git a/modules/cfe_testcase/src/es_cds_test.c b/modules/cfe_testcase/src/es_cds_test.c index 8520dd4fb..494a75cfa 100644 --- a/modules/cfe_testcase/src/es_cds_test.c +++ b/modules/cfe_testcase/src/es_cds_test.c @@ -38,14 +38,15 @@ void TestRegisterCDS(void) CFE_ES_CDSHandle_t CDSHandlePtr; CFE_ES_CDSHandle_t CDSHandlePtr2; - size_t BlockSize = 10; - const char * Name = "CDS_Test"; - const char * LongName = "VERY_LONG_NAME_CDS_Test"; + size_t BlockSize = 10; + size_t BlockSize2 = 15; + const char * Name = "CDS_Test"; + const char * LongName = "VERY_LONG_NAME_CDS_Test"; CFE_Status_t status; UtPrintf("Testing: CFE_ES_RegisterCDS"); - status = CFE_ES_RegisterCDS(&CDSHandlePtr, BlockSize, Name); + status = CFE_ES_RegisterCDS(&CDSHandlePtr, BlockSize2, Name); if (status == CFE_ES_CDS_ALREADY_EXISTS) { @@ -56,7 +57,8 @@ void TestRegisterCDS(void) UtAssert_INT32_EQ(status, CFE_SUCCESS); } - UtAssert_INT32_EQ(CFE_ES_RegisterCDS(&CDSHandlePtr2, BlockSize, Name), CFE_ES_CDS_ALREADY_EXISTS); + UtAssert_INT32_EQ(CFE_ES_RegisterCDS(&CDSHandlePtr2, BlockSize2, Name), CFE_ES_CDS_ALREADY_EXISTS); + UtAssert_INT32_EQ(CFE_ES_RegisterCDS(&CDSHandlePtr2, BlockSize, Name), CFE_SUCCESS); UtAssert_INT32_EQ(CFE_ES_RegisterCDS(NULL, BlockSize, Name), CFE_ES_BAD_ARGUMENT); UtAssert_INT32_EQ(CFE_ES_RegisterCDS(&CDSHandlePtr, 0, Name), CFE_ES_CDS_INVALID_SIZE);