handle mem failure
This commit is contained in:
parent
542a6d3672
commit
69b36fee44
|
@ -1349,6 +1349,9 @@ bool cliConnMayAddUserInfo(SCliConn* pConn, STransMsgHead** ppHead, int32_t* msg
|
|||
}
|
||||
STransMsgHead* pHead = *ppHead;
|
||||
STransMsgHead* tHead = taosMemoryCalloc(1, *msgLen + sizeof(pInst->user));
|
||||
if (tHead == NULL) {
|
||||
return false;
|
||||
}
|
||||
memcpy((char*)tHead, (char*)pHead, TRANS_MSG_OVERHEAD);
|
||||
memcpy((char*)tHead + TRANS_MSG_OVERHEAD, pInst->user, sizeof(pInst->user));
|
||||
|
||||
|
@ -1435,6 +1438,10 @@ int32_t cliBatchSend(SCliConn* pConn, int8_t direct) {
|
|||
if (cliConnMayAddUserInfo(pConn, &pHead, &msgLen)) {
|
||||
content = transContFromHead(pHead);
|
||||
contLen = transContLenFromMsg(msgLen);
|
||||
} else {
|
||||
if (pConn->userInited == 0) {
|
||||
return terrno;
|
||||
}
|
||||
}
|
||||
if (pHead->comp == 0) {
|
||||
pHead->noResp = REQUEST_NO_RESP(pReq) ? 1 : 0;
|
||||
|
|
|
@ -1289,8 +1289,8 @@ static FORCE_INLINE SSvrConn* createConn(void* hThrd) {
|
|||
int32_t code = 0;
|
||||
SWorkThrd* pThrd = hThrd;
|
||||
int32_t lino;
|
||||
|
||||
SSvrConn* pConn = (SSvrConn*)taosMemoryCalloc(1, sizeof(SSvrConn));
|
||||
int8_t wqInited = 0;
|
||||
SSvrConn* pConn = (SSvrConn*)taosMemoryCalloc(1, sizeof(SSvrConn));
|
||||
if (pConn == NULL) {
|
||||
TAOS_CHECK_GOTO(TSDB_CODE_OUT_OF_MEMORY, &lino, _end);
|
||||
}
|
||||
|
@ -1340,6 +1340,7 @@ static FORCE_INLINE SSvrConn* createConn(void* hThrd) {
|
|||
|
||||
code = initWQ(&pConn->wq);
|
||||
TAOS_CHECK_GOTO(code, &lino, _end);
|
||||
wqInited = 1;
|
||||
|
||||
// init client handle
|
||||
pConn->pTcp = (uv_tcp_t*)taosMemoryMalloc(sizeof(uv_tcp_t));
|
||||
|
@ -1372,7 +1373,7 @@ _end:
|
|||
transDestroyBuffer(&pConn->readBuf);
|
||||
taosHashCleanup(pConn->pQTable);
|
||||
taosMemoryFree(pConn->pTcp);
|
||||
destroyWQ(&pConn->wq);
|
||||
if (wqInited) destroyWQ(&pConn->wq);
|
||||
taosMemoryFree(pConn->buf);
|
||||
taosMemoryFree(pConn);
|
||||
pConn = NULL;
|
||||
|
|
Loading…
Reference in New Issue