fix: memleak in taosSplitS3Cfg

This commit is contained in:
Shungang Li 2024-08-12 14:26:02 +08:00
parent 1e83be102d
commit 21f8d6b7c1
2 changed files with 6 additions and 1 deletions

View File

@ -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) {

View File

@ -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);
}