diff --git a/source/common/src/cos.c b/source/common/src/cos.c index 250a4815f4..f02130d468 100644 --- a/source/common/src/cos.c +++ b/source/common/src/cos.c @@ -704,7 +704,7 @@ static int32_t s3PutObjectFromFileWithoutCp(S3BucketContext *bucket_context, cha manager.etags = (char **)taosMemoryCalloc(totalSeq, sizeof(char *)); if (!manager.etags) { - TAOS_CHECK_GOTO(TSDB_CODE_OUT_OF_MEMORY, &lino, _exit); + TAOS_CHECK_GOTO(terrno, &lino, _exit); } manager.next_etags_pos = 0; do { @@ -810,7 +810,7 @@ static int32_t s3PutObjectFromFileWithCp(S3BucketContext *bucket_context, const SCheckpoint cp = {0}; cp.parts = taosMemoryCalloc(max_part_num, sizeof(SCheckpointPart)); if (!cp.parts) { - TAOS_CHECK_GOTO(TSDB_CODE_OUT_OF_MEMORY, &lino, _exit); + TAOS_CHECK_GOTO(terrno, &lino, _exit); } if (taosCheckExistFile(file_cp_path)) { @@ -858,7 +858,7 @@ static int32_t s3PutObjectFromFileWithCp(S3BucketContext *bucket_context, const manager.etags = (char **)taosMemoryCalloc(totalSeq, sizeof(char *)); if (!manager.etags) { - TAOS_CHECK_GOTO(TSDB_CODE_OUT_OF_MEMORY, &lino, _exit); + TAOS_CHECK_GOTO(terrno, &lino, _exit); } manager.next_etags_pos = 0; @@ -1831,7 +1831,7 @@ int32_t s3GetObjectBlock(const char *object_name, int64_t offset, int64_t block_ // char *buf = cos_pcalloc(p, (apr_size_t)(len + 1)); char *buf = taosMemoryCalloc(1, (apr_size_t)(len)); if (!buf) { - TAOS_CHECK_GOTO(TSDB_CODE_OUT_OF_MEMORY, &lino, _exit); + TAOS_CHECK_GOTO(terrno, &lino, _exit); } // buf[len] = '\0'; diff --git a/source/common/src/tdataformat.c b/source/common/src/tdataformat.c index 6f4f4a6162..b831860512 100644 --- a/source/common/src/tdataformat.c +++ b/source/common/src/tdataformat.c @@ -271,7 +271,7 @@ static int32_t tRowBuildTupleRow(SArray *aColVal, const SRowBuildScanInfo *sinfo *ppRow = (SRow *)taosMemoryCalloc(1, sinfo->tupleRowSize); if (*ppRow == NULL) { - return TSDB_CODE_OUT_OF_MEMORY; + return terrno; } (*ppRow)->flag = sinfo->tupleFlag; (*ppRow)->numOfPKs = sinfo->numOfPKs; @@ -354,7 +354,7 @@ static int32_t tRowBuildKVRow(SArray *aColVal, const SRowBuildScanInfo *sinfo, c *ppRow = (SRow *)taosMemoryCalloc(1, sinfo->kvRowSize); if (*ppRow == NULL) { - return TSDB_CODE_OUT_OF_MEMORY; + return terrno; } (*ppRow)->flag = sinfo->kvFlag; (*ppRow)->numOfPKs = sinfo->numOfPKs; @@ -663,7 +663,7 @@ static int32_t tRowMergeImpl(SArray *aRowP, STSchema *pTSchema, int32_t iStart, aIter = taosMemoryCalloc(nRow, sizeof(SRowIter *)); if (aIter == NULL) { - code = TSDB_CODE_OUT_OF_MEMORY; + code = terrno; goto _exit; } @@ -799,7 +799,7 @@ int32_t tRowIterOpen(SRow *pRow, STSchema *pTSchema, SRowIter **ppIter) { SRowIter *pIter = taosMemoryCalloc(1, sizeof(*pIter)); if (pIter == NULL) { - code = TSDB_CODE_OUT_OF_MEMORY; + code = terrno; goto _exit; } @@ -1600,7 +1600,7 @@ int32_t tTagNew(SArray *pArray, int32_t version, int8_t isJson, STag **ppTag) { // build tag (*ppTag) = (STag *)taosMemoryCalloc(szTag, 1); if ((*ppTag) == NULL) { - code = TSDB_CODE_OUT_OF_MEMORY; + code = terrno; goto _err; } (*ppTag)->flags = 0; @@ -3231,7 +3231,7 @@ static int32_t tColDataMergeSortMerge(SColData *aColData, int32_t start, int32_t if (end > start) { aDstColData = taosMemoryCalloc(1, sizeof(SColData) * nColData); if (aDstColData == NULL) { - return TSDB_CODE_OUT_OF_MEMORY; + return terrno; } for (int c = 0; c < nColData; ++c) { tColDataInit(&aDstColData[c], aColData[c].cid, aColData[c].type, aColData[c].cflag); diff --git a/source/common/src/tmsg.c b/source/common/src/tmsg.c index 7973aa1b46..f02463656d 100644 --- a/source/common/src/tmsg.c +++ b/source/common/src/tmsg.c @@ -1829,7 +1829,7 @@ int32_t cloneSUpdateIpWhiteReq(SUpdateIpWhite *pReq, SUpdateIpWhite **pUpdateMsg } SUpdateIpWhite *pClone = taosMemoryCalloc(1, sizeof(SUpdateIpWhite)); if (pClone == NULL) { - return TSDB_CODE_OUT_OF_MEMORY; + return terrno; } pClone->numOfUser = pReq->numOfUser; @@ -1837,7 +1837,7 @@ int32_t cloneSUpdateIpWhiteReq(SUpdateIpWhite *pReq, SUpdateIpWhite **pUpdateMsg pClone->pUserIpWhite = taosMemoryCalloc(1, sizeof(SUpdateUserIpWhite) * pReq->numOfUser); if (pClone->pUserIpWhite == NULL) { taosMemoryFree(pClone); - return TSDB_CODE_OUT_OF_MEMORY; + return terrno; } for (int i = 0; i < pReq->numOfUser; i++) { @@ -1851,7 +1851,7 @@ int32_t cloneSUpdateIpWhiteReq(SUpdateIpWhite *pReq, SUpdateIpWhite **pUpdateMsg int32_t sz = pOld->numOfRange * sizeof(SIpV4Range); pNew->pIpRanges = taosMemoryCalloc(1, sz); if (pNew->pIpRanges == NULL) { - code = TSDB_CODE_OUT_OF_MEMORY; + code = terrno; break; } memcpy(pNew->pIpRanges, pOld->pIpRanges, sz); @@ -10669,7 +10669,7 @@ int32_t tCloneTbTSMAInfo(STableTSMAInfo *pInfo, STableTSMAInfo **pRes) { return TSDB_CODE_SUCCESS; } STableTSMAInfo *pRet = taosMemoryCalloc(1, sizeof(STableTSMAInfo)); - if (!pRet) return TSDB_CODE_OUT_OF_MEMORY; + if (!pRet) return terrno; *pRet = *pInfo; if (pInfo->pFuncs) { diff --git a/source/common/src/trow.c b/source/common/src/trow.c index 3e0e52a860..760b86dee1 100644 --- a/source/common/src/trow.c +++ b/source/common/src/trow.c @@ -473,7 +473,7 @@ int32_t tdSTSRowNew(SArray *pArray, STSchema *pTSchema, STSRow **ppRow, int8_t r } if (!(*ppRow)) { - TAOS_RETURN(TSDB_CODE_OUT_OF_MEMORY); + TAOS_RETURN(terrno); } if (maxVarDataLen > 0) { diff --git a/source/common/src/ttime.c b/source/common/src/ttime.c index 79847d4e4a..d771830d3f 100644 --- a/source/common/src/ttime.c +++ b/source/common/src/ttime.c @@ -539,7 +539,7 @@ int32_t convertStringToTimestamp(int16_t type, char* inputData, int64_t timePrec if (type == TSDB_DATA_TYPE_BINARY || type == TSDB_DATA_TYPE_VARBINARY) { newColData = taosMemoryCalloc(1, charLen + 1); if (NULL == newColData) { - TAOS_RETURN(TSDB_CODE_OUT_OF_MEMORY); + TAOS_RETURN(terrno); } (void)memcpy(newColData, varDataVal(inputData), charLen); int32_t ret = taosParseTime(newColData, timeVal, charLen, (int32_t)timePrec, tsDaylight); @@ -551,7 +551,7 @@ int32_t convertStringToTimestamp(int16_t type, char* inputData, int64_t timePrec } else if (type == TSDB_DATA_TYPE_NCHAR) { newColData = taosMemoryCalloc(1, charLen + TSDB_NCHAR_SIZE); if (NULL == newColData) { - TAOS_RETURN(TSDB_CODE_OUT_OF_MEMORY); + TAOS_RETURN(terrno); } int len = taosUcs4ToMbs((TdUcs4*)varDataVal(inputData), charLen, newColData); if (len < 0) { diff --git a/source/dnode/mgmt/mgmt_dnode/src/dmHandle.c b/source/dnode/mgmt/mgmt_dnode/src/dmHandle.c index 0de0a34c25..9c22a11674 100644 --- a/source/dnode/mgmt/mgmt_dnode/src/dmHandle.c +++ b/source/dnode/mgmt/mgmt_dnode/src/dmHandle.c @@ -365,7 +365,7 @@ int32_t dmBuildVariablesBlock(SSDataBlock **ppBlock) { SSDataBlock *pBlock = taosMemoryCalloc(1, sizeof(SSDataBlock)); if (pBlock == NULL) { - return TSDB_CODE_OUT_OF_MEMORY; + return terrno; } size_t size = 0; diff --git a/source/dnode/mgmt/mgmt_mnode/src/mmInt.c b/source/dnode/mgmt/mgmt_mnode/src/mmInt.c index 48606b2ed9..b1b7a90db8 100644 --- a/source/dnode/mgmt/mgmt_mnode/src/mmInt.c +++ b/source/dnode/mgmt/mgmt_mnode/src/mmInt.c @@ -97,7 +97,7 @@ static int32_t mmOpen(SMgmtInputOpt *pInput, SMgmtOutputOpt *pOutput) { SMnodeMgmt *pMgmt = taosMemoryCalloc(1, sizeof(SMnodeMgmt)); if (pMgmt == NULL) { - code = TSDB_CODE_OUT_OF_MEMORY; + code = terrno; return code; } diff --git a/source/dnode/mgmt/mgmt_qnode/src/qmInt.c b/source/dnode/mgmt/mgmt_qnode/src/qmInt.c index 3138614189..100a11f532 100644 --- a/source/dnode/mgmt/mgmt_qnode/src/qmInt.c +++ b/source/dnode/mgmt/mgmt_qnode/src/qmInt.c @@ -41,7 +41,7 @@ static int32_t qmOpen(SMgmtInputOpt *pInput, SMgmtOutputOpt *pOutput) { int32_t code = 0; SQnodeMgmt *pMgmt = taosMemoryCalloc(1, sizeof(SQnodeMgmt)); if (pMgmt == NULL) { - return TSDB_CODE_OUT_OF_MEMORY; + return terrno; } pMgmt->pData = pInput->pData; diff --git a/source/dnode/mgmt/mgmt_snode/src/smInt.c b/source/dnode/mgmt/mgmt_snode/src/smInt.c index 6bc0131e63..eea3585c72 100644 --- a/source/dnode/mgmt/mgmt_snode/src/smInt.c +++ b/source/dnode/mgmt/mgmt_snode/src/smInt.c @@ -44,7 +44,7 @@ int32_t smOpen(SMgmtInputOpt *pInput, SMgmtOutputOpt *pOutput) { int32_t code = 0; SSnodeMgmt *pMgmt = taosMemoryCalloc(1, sizeof(SSnodeMgmt)); if (pMgmt == NULL) { - code = TSDB_CODE_OUT_OF_MEMORY; + code = terrno; return code; } diff --git a/source/dnode/mgmt/mgmt_vnode/src/vmFile.c b/source/dnode/mgmt/mgmt_vnode/src/vmFile.c index 4f2c04c6a5..8513d31695 100644 --- a/source/dnode/mgmt/mgmt_vnode/src/vmFile.c +++ b/source/dnode/mgmt/mgmt_vnode/src/vmFile.c @@ -27,7 +27,7 @@ int32_t vmGetVnodeListFromHash(SVnodeMgmt *pMgmt, int32_t *numOfVnodes, SVnodeOb SVnodeObj **pVnodes = taosMemoryCalloc(size, sizeof(SVnodeObj *)); if (pVnodes == NULL) { (void)taosThreadRwlockUnlock(&pMgmt->lock); - return TSDB_CODE_OUT_OF_MEMORY; + return terrno; } void *pIter = taosHashIterate(pMgmt->hash, NULL); @@ -62,7 +62,7 @@ static int32_t vmDecodeVnodeList(SJson *pJson, SVnodeMgmt *pMgmt, SWrapperCfg ** int32_t vnodesNum = cJSON_GetArraySize(vnodes); if (vnodesNum > 0) { pCfgs = taosMemoryCalloc(vnodesNum, sizeof(SWrapperCfg)); - if (pCfgs == NULL) return TSDB_CODE_OUT_OF_MEMORY; + if (pCfgs == NULL) return terrno; } for (int32_t i = 0; i < vnodesNum; ++i) { diff --git a/source/dnode/mgmt/mgmt_vnode/src/vmInt.c b/source/dnode/mgmt/mgmt_vnode/src/vmInt.c index e85794b568..488a4d3b99 100644 --- a/source/dnode/mgmt/mgmt_vnode/src/vmInt.c +++ b/source/dnode/mgmt/mgmt_vnode/src/vmInt.c @@ -592,7 +592,7 @@ static int32_t vmInit(SMgmtInputOpt *pInput, SMgmtOutputOpt *pOutput) { SVnodeMgmt *pMgmt = taosMemoryCalloc(1, sizeof(SVnodeMgmt)); if (pMgmt == NULL) { - code = TSDB_CODE_OUT_OF_MEMORY; + code = terrno; goto _OVER; } @@ -727,7 +727,7 @@ static int32_t vmStartVnodes(SVnodeMgmt *pMgmt) { SVnodeThread *threads = taosMemoryCalloc(threadNum, sizeof(SVnodeThread)); if (threads == NULL) { - return TSDB_CODE_OUT_OF_MEMORY; + return terrno; } for (int32_t t = 0; t < threadNum; ++t) { @@ -735,7 +735,7 @@ static int32_t vmStartVnodes(SVnodeMgmt *pMgmt) { threads[t].pMgmt = pMgmt; threads[t].ppVnodes = taosMemoryCalloc(vnodesPerThread, sizeof(SVnode *)); if (threads[t].ppVnodes == NULL) { - code = TSDB_CODE_OUT_OF_MEMORY; + code = terrno; break; } }