shithub: openh264

Download patch

ref: bfc4f5154840d0b3a3d611f65bd460826a8fcaf0
parent: a19a4e5fa6d0d8b1316c3aa1af1ca38863497d12
parent: 3b2605135f7539c39f6cd7c37ca241d9bce77459
author: YangChun Qian <[email protected]>
date: Sun Apr 8 07:09:01 EDT 2018

Merge pull request #2952 from GuangweiWang/fix-issue-external

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;
 }