destroy non-null array before return

This commit is contained in:
Minglei Jin 2024-08-07 08:44:09 +08:00
parent c170cb4cf9
commit 3d29fde68c
1 changed files with 9 additions and 0 deletions

View File

@ -1412,6 +1412,8 @@ static int32_t tsdbCacheLoadFromRaw(STsdb *pTsdb, tb_uid_t uid, SArray *pLastArr
if (NULL == lastTmpIndexArray) {
lastTmpIndexArray = taosArrayInit(num_keys, sizeof(int32_t));
if (!lastTmpIndexArray) {
taosArrayDestroy(lastrowTmpIndexArray);
TAOS_RETURN(TSDB_CODE_OUT_OF_MEMORY);
}
}
@ -1423,6 +1425,8 @@ static int32_t tsdbCacheLoadFromRaw(STsdb *pTsdb, tb_uid_t uid, SArray *pLastArr
if (NULL == lastrowTmpIndexArray) {
lastrowTmpIndexArray = taosArrayInit(num_keys, sizeof(int32_t));
if (!lastrowTmpIndexArray) {
taosArrayDestroy(lastTmpIndexArray);
TAOS_RETURN(TSDB_CODE_OUT_OF_MEMORY);
}
}
@ -1434,6 +1438,11 @@ static int32_t tsdbCacheLoadFromRaw(STsdb *pTsdb, tb_uid_t uid, SArray *pLastArr
}
pTmpColArray = taosArrayInit(lastIndex + lastrowIndex, sizeof(SLastCol));
if (!pTmpColArray) {
taosArrayDestroy(lastrowTmpIndexArray);
taosArrayDestroy(lastTmpIndexArray);
TAOS_RETURN(TSDB_CODE_OUT_OF_MEMORY);
}
if (lastTmpIndexArray != NULL) {
(void)mergeLastCid(uid, pTsdb, &lastTmpColArray, pr, lastColIds, lastIndex, lastSlotIds);