Merge remote-tracking branch 'origin/3.0' into enh/opt-transport

This commit is contained in:
yihaoDeng 2024-09-29 13:13:51 +08:00
parent e94a4a6d1e
commit 108139ffad
1 changed files with 15 additions and 11 deletions

View File

@ -2881,22 +2881,20 @@ static int32_t transInitMsg(void* pInstRef, const SEpSet* pEpSet, STransMsg* pRe
int32_t code = 0; int32_t code = 0;
TRACE_SET_MSGID(&pReq->info.traceId, tGenIdPI64()); TRACE_SET_MSGID(&pReq->info.traceId, tGenIdPI64());
SCliReq* pCliReq = NULL;
SReqCtx* pCtx = taosMemoryCalloc(1, sizeof(SReqCtx)); SReqCtx* pCtx = taosMemoryCalloc(1, sizeof(SReqCtx));
if (pCtx == NULL) { if (pCtx == NULL) {
return terrno; TAOS_CHECK_GOTO(terrno, NULL, _exception);
} }
code = transCreateReqEpsetFromUserEpset(pEpSet, &pCtx->epSet); code = transCreateReqEpsetFromUserEpset(pEpSet, &pCtx->epSet);
if (code != 0) { if (code != 0) {
taosMemoryFree(pCtx); TAOS_CHECK_GOTO(code, NULL, _exception);
return code;
} }
code = transCreateReqEpsetFromUserEpset(pEpSet, &pCtx->origEpSet); code = transCreateReqEpsetFromUserEpset(pEpSet, &pCtx->origEpSet);
if (code != 0) { if (code != 0) {
taosMemoryFree(pCtx); TAOS_CHECK_GOTO(code, NULL, _exception);
taosMemoryFree(pCtx->epSet);
return code;
} }
pCtx->ahandle = pReq->info.ahandle; pCtx->ahandle = pReq->info.ahandle;
@ -2904,10 +2902,9 @@ static int32_t transInitMsg(void* pInstRef, const SEpSet* pEpSet, STransMsg* pRe
if (ctx != NULL) pCtx->userCtx = *ctx; if (ctx != NULL) pCtx->userCtx = *ctx;
SCliReq* pCliReq = taosMemoryCalloc(1, sizeof(SCliReq)); pCliReq = taosMemoryCalloc(1, sizeof(SCliReq));
if (pReq == NULL) { if (pReq == NULL) {
taosMemoryFree(pCtx); TAOS_CHECK_GOTO(terrno, NULL, _exception);
return terrno;
} }
pCliReq->ctx = pCtx; pCliReq->ctx = pCtx;
@ -2916,8 +2913,15 @@ static int32_t transInitMsg(void* pInstRef, const SEpSet* pEpSet, STransMsg* pRe
pCliReq->type = Normal; pCliReq->type = Normal;
*pCliMsg = pCliReq; *pCliMsg = pCliReq;
return code;
return 0; _exception:
if (pCtx == NULL) {
taosMemoryFree(pCtx->epSet);
taosMemoryFree(pCtx->origEpSet);
taosMemoryFree(pCtx);
}
taosMemoryFree(pCliReq);
return code;
} }
int32_t transSendRequest(void* pInstRef, const SEpSet* pEpSet, STransMsg* pReq, STransCtx* ctx) { int32_t transSendRequest(void* pInstRef, const SEpSet* pEpSet, STransMsg* pReq, STransCtx* ctx) {