diff --git a/source/dnode/vnode/src/tsdb/tsdbCache.c b/source/dnode/vnode/src/tsdb/tsdbCache.c index 0e0e055e64..ccad7bac5e 100644 --- a/source/dnode/vnode/src/tsdb/tsdbCache.c +++ b/source/dnode/vnode/src/tsdb/tsdbCache.c @@ -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);