ref: 74955c877fabef965a7d902b528fa8fff3ca6851
parent: cc675f9fd14f9fbde55ee0408adb9e4b0edc9ed3
author: sijchen <sijchen@cisco.com>
date: Tue Feb 16 07:17:21 EST 2016
set pointers to null and call uninit
--- a/codec/common/src/WelsThreadPool.cpp
+++ b/codec/common/src/WelsThreadPool.cpp
@@ -52,16 +52,28 @@
if (NULL == m_cWaitedTasks || NULL == m_cIdleThreads || NULL == m_cBusyThreads) {
delete m_cWaitedTasks;
+ m_cWaitedTasks = NULL;
+
delete m_cIdleThreads;
+ m_cIdleThreads = NULL;
+
delete m_cBusyThreads;
+ m_cBusyThreads = NULL;
+
return;
}
if (WELS_THREAD_ERROR_OK != Init (iMaxThreadNum)) {
Uninit();
+
delete m_cWaitedTasks;
+ m_cWaitedTasks = NULL;
+
delete m_cIdleThreads;
+ m_cIdleThreads = NULL;
+
delete m_cBusyThreads;
+ m_cBusyThreads = NULL;
}
}
@@ -70,8 +82,13 @@
Uninit();
delete m_cWaitedTasks;
+ m_cWaitedTasks = NULL;
+
delete m_cIdleThreads;
+ m_cIdleThreads = NULL;
+
delete m_cBusyThreads;
+ m_cBusyThreads = NULL;
}
WELS_THREAD_ERROR_CODE CWelsThreadPool::OnTaskStart (CWelsTaskThread* pThread, IWelsTask* pTask) {
--- a/codec/encoder/core/src/wels_task_management.cpp
+++ b/codec/encoder/core/src/wels_task_management.cpp
@@ -66,6 +66,7 @@
WELS_VERIFY_RETURN_IF (NULL, NULL == pTaskManage)
if ( ENC_RETURN_SUCCESS != pTaskManage->Init (pCtx) ) {
+ pTaskManage->Uninit();
delete pTaskManage;
pTaskManage = NULL;
}