fix:memory leak
This commit is contained in:
parent
cce868d140
commit
18d05ff69f
|
@ -307,10 +307,14 @@ int32_t tqRegisterPushEntry(STQ* pTq, void* handle, SRpcMsg* pMsg) {
|
||||||
STqHandle* pHandle = (STqHandle*) handle;
|
STqHandle* pHandle = (STqHandle*) handle;
|
||||||
if(pHandle->msg == NULL){
|
if(pHandle->msg == NULL){
|
||||||
pHandle->msg = taosMemoryCalloc(1, sizeof(SRpcMsg));
|
pHandle->msg = taosMemoryCalloc(1, sizeof(SRpcMsg));
|
||||||
}
|
|
||||||
|
|
||||||
memcpy(pHandle->msg, pMsg, sizeof(SRpcMsg));
|
memcpy(pHandle->msg, pMsg, sizeof(SRpcMsg));
|
||||||
pHandle->msg->pCont = rpcMallocCont(pMsg->contLen);
|
pHandle->msg->pCont = rpcMallocCont(pMsg->contLen);
|
||||||
|
}else{
|
||||||
|
void *tmp = pHandle->msg->pCont;
|
||||||
|
memcpy(pHandle->msg, pMsg, sizeof(SRpcMsg));
|
||||||
|
pHandle->msg->pCont = tmp;
|
||||||
|
}
|
||||||
|
|
||||||
memcpy(pHandle->msg->pCont, pMsg->pCont, pMsg->contLen);
|
memcpy(pHandle->msg->pCont, pMsg->pCont, pMsg->contLen);
|
||||||
pHandle->msg->contLen = pMsg->contLen;
|
pHandle->msg->contLen = pMsg->contLen;
|
||||||
int32_t ret = taosHashPut(pTq->pPushMgr, pHandle->subKey, strlen(pHandle->subKey), &pHandle, POINTER_BYTES);
|
int32_t ret = taosHashPut(pTq->pPushMgr, pHandle->subKey, strlen(pHandle->subKey), &pHandle, POINTER_BYTES);
|
||||||
|
|
Loading…
Reference in New Issue