diff --git a/source/common/src/cos.c b/source/common/src/cos.c index 7fa390d3bb..8312d02bff 100644 --- a/source/common/src/cos.c +++ b/source/common/src/cos.c @@ -955,7 +955,11 @@ static int32_t s3InitEpIndexArray(SArray **pIndexArray) { } for (int8_t i = 0; i < tsS3EpNum; ++i) { - taosArraySet(indexArray, i, &i); + if (taosArrayPush(indexArray, &i) == NULL) { + taosArrayDestroy(indexArray); + uError("%s: %s", __func__, "out of memory"); + TAOS_RETURN(TSDB_CODE_OUT_OF_MEMORY); + } } if (tsS3EpNum > 1) { diff --git a/source/common/src/tglobal.c b/source/common/src/tglobal.c index e3048bcecf..4e32288123 100644 --- a/source/common/src/tglobal.c +++ b/source/common/src/tglobal.c @@ -376,6 +376,7 @@ static int32_t taosSplitS3Cfg(SConfig *pCfg, const char *name, char gVarible[TSD *pNum = num; _exit: + taosMemoryFreeClear(slices); taosMemoryFreeClear(strDup); TAOS_RETURN(code); }