From 010a1da48294734f1c4f6febd847749219d6881a Mon Sep 17 00:00:00 2001 From: xsren <285808407@qq.com> Date: Tue, 16 Jul 2024 09:40:19 +0800 Subject: [PATCH] return value: querymsg.c --- source/client/src/clientEnv.c | 6 +++++- source/client/src/clientRawBlockWrite.c | 13 +++++++++++-- source/libs/command/src/command.c | 3 +-- source/libs/qcom/src/querymsg.c | 6 ++++++ 4 files changed, 23 insertions(+), 5 deletions(-) diff --git a/source/client/src/clientEnv.c b/source/client/src/clientEnv.c index 18907ede5d..7d737fbb8e 100644 --- a/source/client/src/clientEnv.c +++ b/source/client/src/clientEnv.c @@ -885,7 +885,11 @@ void taos_init_imp(void) { taosSetCoreDump(true); #endif - initTaskQueue(); + if (initTaskQueue() != 0){ + tscInitRes = -1; + tscError("failed to init task queue"); + return; + } fmFuncMgtInit(); nodesInitAllocatorSet(); diff --git a/source/client/src/clientRawBlockWrite.c b/source/client/src/clientRawBlockWrite.c index 2fabf01ef4..9e1ff6e5e5 100644 --- a/source/client/src/clientRawBlockWrite.c +++ b/source/client/src/clientRawBlockWrite.c @@ -460,8 +460,14 @@ static void buildChildElement(cJSON* json, SVCreateTbReq* pCreateReq) { } else { buf = taosMemoryCalloc(pTagVal->nData + 3, 1); } + RAW_NULL_CHECK(buf); - RAW_RETURN_CHECK(dataConverToStr(buf, pTagVal->type, pTagVal->pData, pTagVal->nData, NULL)); + if (!buf) goto end; + if(dataConverToStr(buf, pTagVal->type, pTagVal->pData, pTagVal->nData, NULL) != TSDB_CODE_SUCCESS) { + taosMemoryFree(buf); + goto end; + } + tvalue = cJSON_CreateString(buf); RAW_NULL_CHECK(tvalue); taosMemoryFree(buf); @@ -729,7 +735,10 @@ static void processAlterTable(SMqMetaRsp* metaRsp, cJSON** pJson) { buf = taosMemoryCalloc(vAlterTbReq.nTagVal + 3, 1); } RAW_NULL_CHECK(buf); - RAW_RETURN_CHECK(dataConverToStr(buf, vAlterTbReq.tagType, vAlterTbReq.pTagVal, vAlterTbReq.nTagVal, NULL)); + if(dataConverToStr(buf, vAlterTbReq.tagType, vAlterTbReq.pTagVal, vAlterTbReq.nTagVal, NULL) != TSDB_CODE_SUCCESS) { + taosMemoryFree(buf); + goto end; + } } cJSON* colValue = cJSON_CreateString(buf); diff --git a/source/libs/command/src/command.c b/source/libs/command/src/command.c index 4cd87b139e..8b2415128a 100644 --- a/source/libs/command/src/command.c +++ b/source/libs/command/src/command.c @@ -672,8 +672,7 @@ static int32_t setCreateTBResultIntoDataBlock(SSDataBlock* pBlock, SDbCfgInfo* p SColumnInfoData* pCol2 = taosArrayGet(pBlock->pDataBlock, 1); char* buf2 = taosMemoryMalloc(SHOW_CREATE_TB_RESULT_FIELD2_LEN); if (NULL == buf2) { - terrno = TSDB_CODE_OUT_OF_MEMORY; - return terrno; + QRY_ERR_RET(TSDB_CODE_OUT_OF_MEMORY); } int32_t len = 0; diff --git a/source/libs/qcom/src/querymsg.c b/source/libs/qcom/src/querymsg.c index b13919e5e1..1f5b6315ba 100644 --- a/source/libs/qcom/src/querymsg.c +++ b/source/libs/qcom/src/querymsg.c @@ -713,6 +713,9 @@ int32_t queryProcessGetTbCfgRsp(void *output, char *msg, int32_t msgSize) { } STableCfgRsp *out = taosMemoryCalloc(1, sizeof(STableCfgRsp)); + if(out == NULL) { + return TSDB_CODE_OUT_OF_MEMORY; + } if (tDeserializeSTableCfgRsp(msg, msgSize, out) != 0) { qError("tDeserializeSTableCfgRsp failed, msgSize:%d", msgSize); tFreeSTableCfgRsp(out); @@ -731,6 +734,9 @@ int32_t queryProcessGetViewMetaRsp(void *output, char *msg, int32_t msgSize) { } SViewMetaRsp *out = taosMemoryCalloc(1, sizeof(SViewMetaRsp)); + if (out == NULL) { + return TSDB_CODE_OUT_OF_MEMORY; + } if (tDeserializeSViewMetaRsp(msg, msgSize, out) != 0) { qError("tDeserializeSViewMetaRsp failed, msgSize:%d", msgSize); tFreeSViewMetaRsp(out);