fix: avoid memory leak
This commit is contained in:
parent
0e8e04805a
commit
5a8a24b463
|
@ -99,39 +99,15 @@ static inline int32_t mmPutRpcMsgToWorker(SSingleWorker *pWorker, SRpcMsg *pRpc)
|
||||||
}
|
}
|
||||||
|
|
||||||
int32_t mmPutRpcMsgToQueryQueue(SMnodeMgmt *pMgmt, SRpcMsg *pMsg) {
|
int32_t mmPutRpcMsgToQueryQueue(SMnodeMgmt *pMgmt, SRpcMsg *pMsg) {
|
||||||
int32_t code = -1;
|
return mmPutRpcMsgToWorker(&pMgmt->queryWorker, pMsg);
|
||||||
if (mmAcquire(pMgmt) == 0) {
|
|
||||||
mmPutRpcMsgToWorker(&pMgmt->queryWorker, pMsg);
|
|
||||||
mmRelease(pMgmt);
|
|
||||||
} else {
|
|
||||||
rpcFreeCont(pMsg->pCont);
|
|
||||||
pMsg->pCont = NULL;
|
|
||||||
}
|
|
||||||
return code;
|
|
||||||
}
|
}
|
||||||
|
|
||||||
int32_t mmPutRpcMsgToWriteQueue(SMnodeMgmt *pMgmt, SRpcMsg *pMsg) {
|
int32_t mmPutRpcMsgToWriteQueue(SMnodeMgmt *pMgmt, SRpcMsg *pMsg) {
|
||||||
int32_t code = -1;
|
return mmPutRpcMsgToWorker(&pMgmt->writeWorker, pMsg);
|
||||||
if (mmAcquire(pMgmt) == 0) {
|
|
||||||
code = mmPutRpcMsgToWorker(&pMgmt->writeWorker, pMsg);
|
|
||||||
mmRelease(pMgmt);
|
|
||||||
} else {
|
|
||||||
rpcFreeCont(pMsg->pCont);
|
|
||||||
pMsg->pCont = NULL;
|
|
||||||
}
|
|
||||||
return code;
|
|
||||||
}
|
}
|
||||||
|
|
||||||
int32_t mmPutRpcMsgToReadQueue(SMnodeMgmt *pMgmt, SRpcMsg *pMsg) {
|
int32_t mmPutRpcMsgToReadQueue(SMnodeMgmt *pMgmt, SRpcMsg *pMsg) {
|
||||||
int32_t code = -1;
|
return mmPutRpcMsgToWorker(&pMgmt->readWorker, pMsg);
|
||||||
if (mmAcquire(pMgmt) == 0) {
|
|
||||||
code = mmPutRpcMsgToWorker(&pMgmt->readWorker, pMsg);
|
|
||||||
mmRelease(pMgmt);
|
|
||||||
} else {
|
|
||||||
rpcFreeCont(pMsg->pCont);
|
|
||||||
pMsg->pCont = NULL;
|
|
||||||
}
|
|
||||||
return code;
|
|
||||||
}
|
}
|
||||||
|
|
||||||
int32_t mmPutRpcMsgToSyncQueue(SMnodeMgmt *pMgmt, SRpcMsg *pMsg) {
|
int32_t mmPutRpcMsgToSyncQueue(SMnodeMgmt *pMgmt, SRpcMsg *pMsg) {
|
||||||
|
@ -139,7 +115,9 @@ int32_t mmPutRpcMsgToSyncQueue(SMnodeMgmt *pMgmt, SRpcMsg *pMsg) {
|
||||||
if (mmAcquire(pMgmt) == 0) {
|
if (mmAcquire(pMgmt) == 0) {
|
||||||
code = mmPutRpcMsgToWorker(&pMgmt->syncWorker, pMsg);
|
code = mmPutRpcMsgToWorker(&pMgmt->syncWorker, pMsg);
|
||||||
mmRelease(pMgmt);
|
mmRelease(pMgmt);
|
||||||
} else {
|
}
|
||||||
|
|
||||||
|
if (code != 0) {
|
||||||
rpcFreeCont(pMsg->pCont);
|
rpcFreeCont(pMsg->pCont);
|
||||||
pMsg->pCont = NULL;
|
pMsg->pCont = NULL;
|
||||||
}
|
}
|
||||||
|
|
Loading…
Reference in New Issue