!139 配套使用new[]/delete[]

Merge pull request !139 from 陈正跃/master
This commit is contained in:
openharmony_ci
2022-01-18 01:19:23 +00:00
committed by Gitee
2 changed files with 4 additions and 4 deletions
+1 -1
View File
@@ -113,7 +113,7 @@ void DeInitIpcCallBackList(void)
for (i = 0; i < IPC_CALL_BACK_MAX_NODES; i++) {
ResetIpcCallBackNode(g_ipcCallBackList.ctx[i]);
}
delete g_ipcCallBackList.ctx;
delete[] g_ipcCallBackList.ctx;
g_ipcCallBackList.ctx = nullptr;
return;
}
@@ -41,7 +41,7 @@ ServiceDevAuth::~ServiceDevAuth()
{
maxCallMapSz = MAX_CALLMAP_SIZE;
if (callMapTable != nullptr) {
delete callMapTable;
delete[] callMapTable;
callMapTable = nullptr;
}
callMapElemNum = 0;
@@ -212,12 +212,12 @@ int32_t ServiceDevAuth::SetCallMap(IpcServiceCall method, int32_t methodId)
if (callMapTmp != nullptr) {
eno = memcpy_s(callMapTable, len, callMapTmp, (sizeof(IpcServiceCallMap) * callMapElemNum));
if (eno != EOK) {
delete callMapTable;
delete[] callMapTable;
callMapTable = callMapTmp;
maxCallMapSz -= MAX_CALLMAP_SIZE;
return HC_ERR_MEMORY_COPY;
}
delete callMapTmp;
delete[] callMapTmp;
callMapTmp = nullptr;
}
}