handle mem leak failure
This commit is contained in:
parent
daa8341a3e
commit
17077d1a32
|
@ -1770,19 +1770,15 @@ void updateTargetEpSet(SMsgSendInfo* pSendInfo, STscObj* pTscObj, SRpcMsg* pMsg,
|
|||
}
|
||||
}
|
||||
|
||||
int32_t doProcessMsgFromServer(void* param) {
|
||||
AsyncArg* arg = (AsyncArg*)param;
|
||||
SRpcMsg* pMsg = &arg->msg;
|
||||
SEpSet* pEpSet = arg->pEpset;
|
||||
|
||||
int32_t doProcessMsFromServerImpl(SRpcMsg* pMsg, SEpSet* pEpSet) {
|
||||
SMsgSendInfo* pSendInfo = (SMsgSendInfo*)pMsg->info.ahandle;
|
||||
if (pMsg->info.ahandle == NULL) {
|
||||
tscError("doProcessMsgFromServer pMsg->info.ahandle == NULL");
|
||||
taosMemoryFree(arg->pEpset);
|
||||
rpcFreeCont(pMsg->pCont);
|
||||
taosMemoryFree(arg);
|
||||
taosMemoryFree(pEpSet);
|
||||
return TSDB_CODE_TSC_INTERNAL_ERROR;
|
||||
}
|
||||
|
||||
STscObj* pTscObj = NULL;
|
||||
|
||||
STraceId* trace = &pMsg->info.traceId;
|
||||
|
@ -1802,10 +1798,9 @@ int32_t doProcessMsgFromServer(void* param) {
|
|||
if (TSDB_CODE_SUCCESS != taosReleaseRef(clientReqRefPool, pSendInfo->requestObjRefId)) {
|
||||
tscError("doProcessMsgFromServer taosReleaseRef failed");
|
||||
}
|
||||
taosMemoryFree(arg->pEpset);
|
||||
rpcFreeCont(pMsg->pCont);
|
||||
taosMemoryFree(pEpSet);
|
||||
destroySendMsgInfo(pSendInfo);
|
||||
taosMemoryFree(arg);
|
||||
return TSDB_CODE_TSC_INTERNAL_ERROR;
|
||||
}
|
||||
pTscObj = pRequest->pTscObj;
|
||||
|
@ -1844,20 +1839,24 @@ int32_t doProcessMsgFromServer(void* param) {
|
|||
|
||||
rpcFreeCont(pMsg->pCont);
|
||||
destroySendMsgInfo(pSendInfo);
|
||||
|
||||
taosMemoryFree(arg);
|
||||
return TSDB_CODE_SUCCESS;
|
||||
}
|
||||
int32_t doProcessMsgFromServer(void* param) {
|
||||
AsyncArg* arg = (AsyncArg*)param;
|
||||
int32_t code = doProcessMsFromServerImpl(&arg->msg, arg->pEpset);
|
||||
taosMemoryFree(arg);
|
||||
return code;
|
||||
}
|
||||
|
||||
void processMsgFromServer(void* parent, SRpcMsg* pMsg, SEpSet* pEpSet) {
|
||||
int32_t code = 0;
|
||||
SEpSet* tEpSet = NULL;
|
||||
if (pEpSet != NULL) {
|
||||
tEpSet = taosMemoryCalloc(1, sizeof(SEpSet));
|
||||
if (NULL == tEpSet) {
|
||||
pMsg->code = TSDB_CODE_OUT_OF_MEMORY;
|
||||
rpcFreeCont(pMsg->pCont);
|
||||
destroySendMsgInfo(pMsg->info.ahandle);
|
||||
return;
|
||||
code = terrno;
|
||||
pMsg->code = terrno;
|
||||
goto _exit;
|
||||
}
|
||||
(void)memcpy((void*)tEpSet, (void*)pEpSet, sizeof(SEpSet));
|
||||
}
|
||||
|
@ -1879,12 +1878,12 @@ void processMsgFromServer(void* parent, SRpcMsg* pMsg, SEpSet* pEpSet) {
|
|||
|
||||
AsyncArg* arg = taosMemoryCalloc(1, sizeof(AsyncArg));
|
||||
if (NULL == arg) {
|
||||
pMsg->code = TSDB_CODE_OUT_OF_MEMORY;
|
||||
taosMemoryFree(tEpSet);
|
||||
rpcFreeCont(pMsg->pCont);
|
||||
destroySendMsgInfo(pMsg->info.ahandle);
|
||||
code = terrno;
|
||||
pMsg->code = code;
|
||||
goto _exit;
|
||||
return;
|
||||
}
|
||||
|
||||
arg->msg = *pMsg;
|
||||
arg->pEpset = tEpSet;
|
||||
|
||||
|
@ -1895,6 +1894,13 @@ void processMsgFromServer(void* parent, SRpcMsg* pMsg, SEpSet* pEpSet) {
|
|||
destroySendMsgInfo(pMsg->info.ahandle);
|
||||
taosMemoryFree(arg);
|
||||
}
|
||||
return;
|
||||
_exit:
|
||||
tscError("failed to sched msg to tsc since %s", tstrerror(code));
|
||||
code = doProcessMsFromServerImpl(pMsg, tEpSet);
|
||||
if (code != 0) {
|
||||
tscError("failed to sched msg to tsc, tsc ready quit");
|
||||
}
|
||||
}
|
||||
|
||||
TAOS* taos_connect_auth(const char* ip, const char* user, const char* auth, const char* db, uint16_t port) {
|
||||
|
|
Loading…
Reference in New Issue