fix mem leak
This commit is contained in:
parent
54cf5c89e3
commit
d403a6129a
|
@ -155,10 +155,13 @@ void* rpcReallocCont(void* ptr, int64_t contLen) {
|
|||
|
||||
char* st = (char*)ptr - TRANS_MSG_OVERHEAD;
|
||||
int64_t sz = contLen + TRANS_MSG_OVERHEAD;
|
||||
st = taosMemoryRealloc(st, sz);
|
||||
if (st == NULL) {
|
||||
char* nst = taosMemoryRealloc(st, sz);
|
||||
if (nst == NULL) {
|
||||
taosMemoryFree(st);
|
||||
terrno = TSDB_CODE_OUT_OF_MEMORY;
|
||||
return NULL;
|
||||
} else {
|
||||
st = nst;
|
||||
}
|
||||
|
||||
return st + TRANS_MSG_OVERHEAD;
|
||||
|
@ -168,7 +171,7 @@ int32_t rpcSendRequest(void* shandle, const SEpSet* pEpSet, SRpcMsg* pMsg, int64
|
|||
return transSendRequest(shandle, pEpSet, pMsg, NULL);
|
||||
}
|
||||
int32_t rpcSendRequestWithCtx(void* shandle, const SEpSet* pEpSet, SRpcMsg* pMsg, int64_t* pRid, SRpcCtx* pCtx) {
|
||||
if (pCtx != NULL || pMsg->info.handle != 0 || pMsg->info.noResp != 0|| pRid == NULL) {
|
||||
if (pCtx != NULL || pMsg->info.handle != 0 || pMsg->info.noResp != 0 || pRid == NULL) {
|
||||
return transSendRequest(shandle, pEpSet, pMsg, pCtx);
|
||||
} else {
|
||||
return transSendRequestWithId(shandle, pEpSet, pMsg, pRid);
|
||||
|
|
Loading…
Reference in New Issue