ref: 3b2605135f7539c39f6cd7c37ca241d9bce77459
parent: a19a4e5fa6d0d8b1316c3aa1af1ca38863497d12
author: Guangwei <guangwwa@cisco.com>
date: Sun Apr 8 05:12:35 EDT 2018
bug fix for UT: asan check error, memory leak
--- a/test/common/WelsTaskListTest.cpp
+++ b/test/common/WelsTaskListTest.cpp
@@ -18,7 +18,7 @@
CThreadPoolTest cThreadPoolTest;
CThreadPoolTest cThreadPoolTest1;
- CSimpleTask* aTasks[2];
+ CSimpleTask* aTasks[2] = {NULL, NULL};
IWelsTask* pCurTask;
int32_t i;
@@ -54,6 +54,7 @@
EXPECT_TRUE(0 == pTaskList->size());
for (i = 0; i < 2; i++) {
delete aTasks[i];
+ aTasks[i] = NULL;
}
aTasks[0] = new CSimpleTask (&cThreadPoolTest1);
@@ -81,6 +82,10 @@
EXPECT_TRUE(2 == cThreadPoolTest.GetTaskCount());
EXPECT_TRUE(4 == cThreadPoolTest1.GetTaskCount());
+ for (i = 0; i < 2; i++) {
+ delete aTasks[i];
+ aTasks[i] = NULL;
+ }
delete pTaskList;
}