提交 2d9e2f01 编写于 作者: dengyihao's avatar dengyihao

fix: avoid invalid read/write

上级 a4ad2b3f
......@@ -1097,15 +1097,16 @@ void transSendRecv(void* shandle, const SEpSet* pEpSet, STransMsg* pReq, STransM
if (index == -1) {
index = cliRBChoseIdx(pTransInst);
}
tsem_t* sem = taosMemoryCalloc(1, sizeof(tsem_t));
tsem_init(sem, 0, 0);
STransConnCtx* pCtx = taosMemoryCalloc(1, sizeof(STransConnCtx));
pCtx->epSet = *pEpSet;
pCtx->ahandle = pReq->info.ahandle;
pCtx->msgType = pReq->msgType;
pCtx->hThrdIdx = index;
pCtx->pSem = taosMemoryCalloc(1, sizeof(tsem_t));
pCtx->pSem = sem;
pCtx->pRsp = pRsp;
tsem_init(pCtx->pSem, 0, 0);
SCliMsg* cliMsg = taosMemoryCalloc(1, sizeof(SCliMsg));
cliMsg->ctx = pCtx;
......@@ -1118,10 +1119,9 @@ void transSendRecv(void* shandle, const SEpSet* pEpSet, STransMsg* pReq, STransM
EPSET_GET_INUSE_IP(&pCtx->epSet), EPSET_GET_INUSE_PORT(&pCtx->epSet), pReq->info.ahandle);
transSendAsync(thrd->asyncPool, &(cliMsg->q));
tsem_t* pSem = pCtx->pSem;
tsem_wait(pSem);
tsem_destroy(pSem);
taosMemoryFree(pSem);
tsem_wait(sem);
tsem_destroy(sem);
taosMemoryFree(sem);
}
/*
......
......@@ -226,7 +226,7 @@ static bool addHandleToAcceptloop(void* arg);
} else { \
refId = exh1->refId; \
} \
} else if (refId == -1) { \
} else if (refId < 0) { \
tTrace("server handle step3"); \
goto _return2; \
} \
......
Markdown is supported
0% .
You are about to add 0 people to the discussion. Proceed with caution.
先完成此消息的编辑!
想要评论请 注册