From 1a431a423601a6c5f2bb4ec632de87ed0f303b6f Mon Sep 17 00:00:00 2001 From: dcristoloveanu Date: Sun, 7 Feb 2016 19:46:36 -0800 Subject: [PATCH] Fix EH Client LL unit tests memory leak and remove extra filters projects in the build folder --- .../hmacsha256_unittests_dll.vcxproj.filters | 43 ------ .../c/testtools/ctest/ctest.vcxproj.filters | 27 ---- .../ctest_unittests.vcxproj.filters | 40 ------ .../micromock_cpp_unittest.vcxproj.filters | 126 ------------------ .../send_batch/send_batch.vcxproj.filters | 27 ---- .../sendasync/sendasync.vcxproj.filters | 27 ---- c/eventhub_client/src/eventhubclient_ll.c | 2 +- .../eventhubclient_ll_unittests.cpp | 24 +--- 8 files changed, 2 insertions(+), 314 deletions(-) delete mode 100644 c/build/azure-c-shared-utility/c/tests/hmacsha256_unittests/hmacsha256_unittests_dll.vcxproj.filters delete mode 100644 c/build/azure-c-shared-utility/c/testtools/ctest/ctest.vcxproj.filters delete mode 100644 c/build/azure-c-shared-utility/c/testtools/ctest/unittests/ctestunittests/ctest_unittests.vcxproj.filters delete mode 100644 c/build/azure-c-shared-utility/c/testtools/micromock/micromock_cpp_unittest.vcxproj.filters delete mode 100644 c/build/eventhub_client/samples/send_batch/send_batch.vcxproj.filters delete mode 100644 c/build/eventhub_client/samples/sendasync/sendasync.vcxproj.filters diff --git a/c/build/azure-c-shared-utility/c/tests/hmacsha256_unittests/hmacsha256_unittests_dll.vcxproj.filters b/c/build/azure-c-shared-utility/c/tests/hmacsha256_unittests/hmacsha256_unittests_dll.vcxproj.filters deleted file mode 100644 index 00ac63bd..00000000 --- a/c/build/azure-c-shared-utility/c/tests/hmacsha256_unittests/hmacsha256_unittests_dll.vcxproj.filters +++ /dev/null @@ -1,43 +0,0 @@ - - - - - Source Files - - - Source Files - - - Source Files - - - Source Files - - - Source Files - - - Source Files - - - Source Files - - - Source Files - - - Source Files - - - Source Files - - - - - - - - {E0219E58-08BA-43B6-A697-717EF0361C40} - - - diff --git a/c/build/azure-c-shared-utility/c/testtools/ctest/ctest.vcxproj.filters b/c/build/azure-c-shared-utility/c/testtools/ctest/ctest.vcxproj.filters deleted file mode 100644 index 2af050a2..00000000 --- a/c/build/azure-c-shared-utility/c/testtools/ctest/ctest.vcxproj.filters +++ /dev/null @@ -1,27 +0,0 @@ - - - - - Source Files - - - - - Header Files - - - Header Files - - - - - - - - {E0219E58-08BA-43B6-A697-717EF0361C40} - - - {C273AE31-C91C-47C2-AF1F-C68D88F79513} - - - diff --git a/c/build/azure-c-shared-utility/c/testtools/ctest/unittests/ctestunittests/ctest_unittests.vcxproj.filters b/c/build/azure-c-shared-utility/c/testtools/ctest/unittests/ctestunittests/ctest_unittests.vcxproj.filters deleted file mode 100644 index 43c29d61..00000000 --- a/c/build/azure-c-shared-utility/c/testtools/ctest/unittests/ctestunittests/ctest_unittests.vcxproj.filters +++ /dev/null @@ -1,40 +0,0 @@ - - - - - Source Files - - - Source Files - - - Source Files - - - Source Files - - - Source Files - - - Source Files - - - Source Files - - - Source Files - - - Source Files - - - - - - - - {E0219E58-08BA-43B6-A697-717EF0361C40} - - - diff --git a/c/build/azure-c-shared-utility/c/testtools/micromock/micromock_cpp_unittest.vcxproj.filters b/c/build/azure-c-shared-utility/c/testtools/micromock/micromock_cpp_unittest.vcxproj.filters deleted file mode 100644 index 97c567e5..00000000 --- a/c/build/azure-c-shared-utility/c/testtools/micromock/micromock_cpp_unittest.vcxproj.filters +++ /dev/null @@ -1,126 +0,0 @@ - - - - - Source Files - - - Source Files - - - Source Files - - - Source Files - - - Source Files - - - Source Files - - - Source Files - - - - - Header Files - - - Header Files - - - Header Files - - - Header Files - - - Header Files - - - Header Files - - - Header Files - - - Header Files - - - Header Files - - - Header Files - - - Header Files - - - Header Files - - - Header Files - - - Header Files - - - Header Files - - - Header Files - - - Header Files - - - Header Files - - - Header Files - - - Header Files - - - Header Files - - - Header Files - - - Header Files - - - Header Files - - - Header Files - - - Header Files - - - Header Files - - - Header Files - - - Header Files - - - - - - - - {E0219E58-08BA-43B6-A697-717EF0361C40} - - - {C273AE31-C91C-47C2-AF1F-C68D88F79513} - - - diff --git a/c/build/eventhub_client/samples/send_batch/send_batch.vcxproj.filters b/c/build/eventhub_client/samples/send_batch/send_batch.vcxproj.filters deleted file mode 100644 index 7de7d019..00000000 --- a/c/build/eventhub_client/samples/send_batch/send_batch.vcxproj.filters +++ /dev/null @@ -1,27 +0,0 @@ - - - - - Source Files - - - Source Files - - - - - Header Files - - - - - - - - {E0219E58-08BA-43B6-A697-717EF0361C40} - - - {C273AE31-C91C-47C2-AF1F-C68D88F79513} - - - diff --git a/c/build/eventhub_client/samples/sendasync/sendasync.vcxproj.filters b/c/build/eventhub_client/samples/sendasync/sendasync.vcxproj.filters deleted file mode 100644 index 84e2f2aa..00000000 --- a/c/build/eventhub_client/samples/sendasync/sendasync.vcxproj.filters +++ /dev/null @@ -1,27 +0,0 @@ - - - - - Source Files - - - Source Files - - - - - Header Files - - - - - - - - {E0219E58-08BA-43B6-A697-717EF0361C40} - - - {C273AE31-C91C-47C2-AF1F-C68D88F79513} - - - diff --git a/c/eventhub_client/src/eventhubclient_ll.c b/c/eventhub_client/src/eventhubclient_ll.c index 175fd55d..f167828f 100644 --- a/c/eventhub_client/src/eventhubclient_ll.c +++ b/c/eventhub_client/src/eventhubclient_ll.c @@ -649,7 +649,7 @@ EVENTHUBCLIENT_RESULT EventHubClient_LL_SendAsync(EVENTHUBCLIENT_LL_HANDLE event } else { - EVENTHUB_EVENT_LIST *newEntry = (EVENTHUB_EVENT_LIST*)malloc(sizeof(EVENTHUB_EVENT_LIST)); + EVENTHUB_EVENT_LIST* newEntry = (EVENTHUB_EVENT_LIST*)malloc(sizeof(EVENTHUB_EVENT_LIST)); if (newEntry == NULL) { result = EVENTHUBCLIENT_ERROR; diff --git a/c/eventhub_client/tests/eventhubclient_ll_unittests/eventhubclient_ll_unittests.cpp b/c/eventhub_client/tests/eventhubclient_ll_unittests/eventhubclient_ll_unittests.cpp index 5af50ce9..c1def10d 100644 --- a/c/eventhub_client/tests/eventhubclient_ll_unittests/eventhubclient_ll_unittests.cpp +++ b/c/eventhub_client/tests/eventhubclient_ll_unittests/eventhubclient_ll_unittests.cpp @@ -139,9 +139,6 @@ static bool g_setProperty = false; static bool g_includeProperties = false; static DLIST_ENTRY* saved_pending_list; -static size_t currentmalloc_call; -static size_t whenShallmalloc_fail; - static size_t g_current_pn_messenger_call; static size_t g_when_pn_messenger_fail; @@ -353,24 +350,7 @@ public: /* gballoc mocks */ MOCK_STATIC_METHOD_1(, void*, gballoc_malloc, size_t, size) - void* result2; - currentmalloc_call++; - if (whenShallmalloc_fail>0) - { - if (currentmalloc_call == whenShallmalloc_fail) - { - result2 = (void*)NULL; - } - else - { - result2 = BASEIMPLEMENTATION::gballoc_malloc(size); - } - } - else - { - result2 = BASEIMPLEMENTATION::gballoc_malloc(size); - } - MOCK_METHOD_END(void*, result2); + MOCK_METHOD_END(void*, BASEIMPLEMENTATION::gballoc_malloc(size)); MOCK_STATIC_METHOD_2(, void*, gballoc_realloc, void*, ptr, size_t, size) MOCK_METHOD_END(void*, BASEIMPLEMENTATION::gballoc_realloc(ptr, size)); @@ -579,8 +559,6 @@ BEGIN_TEST_SUITE(eventhubclient_ll_unittests) saved_saslclientio_parameters = NULL; saved_sasl_mechanism_create_parameters = NULL; - currentmalloc_call = 0; - whenShallmalloc_fail = 0; g_setProperty = false; g_currentEventClone_call = 0;