add mem check

This commit is contained in:
yihaoDeng 2024-08-09 10:40:38 +08:00
parent 2af86c961a
commit 3eaae2ab75
1 changed files with 28 additions and 28 deletions

View File

@ -1215,8 +1215,7 @@ void cliSendBatch(SCliConn* pConn) {
if (req == NULL) {
code = TSDB_CODE_OUT_OF_MEMORY;
tError("%s conn %p failed to send batch msg since:%s", CONN_GET_INST_LABEL(pConn), pConn, tstrerror(code));
taosMemoryFree(wb);
return;
goto _except;
}
req->data = pConn;
tDebug("%s conn %p start to send batch msg, batch size:%d, msgLen:%d", CONN_GET_INST_LABEL(pConn), pConn,
@ -1225,12 +1224,15 @@ void cliSendBatch(SCliConn* pConn) {
code = uv_write(req, (uv_stream_t*)pConn->stream, wb, wLen, cliSendBatchCb);
if (code != 0) {
tDebug("%s conn %p failed to to send batch msg since %s", CONN_GET_INST_LABEL(pConn), pConn, uv_err_name(code));
goto _except;
}
taosMemoryFree(wb);
return;
_except:
cliDestroyBatch(pBatch);
taosMemoryFree(wb);
pConn->pBatch = NULL;
return;
}
@ -2033,10 +2035,7 @@ static void cliBatchDealReq(queue* wq, SCliThrd* pThrd) {
QUEUE_PUSH(&((*ppBatchList)->wq), &pBatch->listq);
(*ppBatchList)->len += 1;
continue;
}
} else {
queue* hdr = QUEUE_TAIL(&((*ppBatchList)->wq));
SCliBatch* pBatch = QUEUE_DATA(hdr, SCliBatch, listq);
if ((pBatch->batchSize + pMsg->msg.contLen) < (*ppBatchList)->batchLenLimit) {
@ -2062,6 +2061,7 @@ static void cliBatchDealReq(queue* wq, SCliThrd* pThrd) {
(*ppBatchList)->len += 1;
}
}
}
continue;
}
(*cliAsyncHandle[pMsg->type])(pMsg, pThrd);