From 88e2c1e18af1ec4567f8c36499f4929aec2280de Mon Sep 17 00:00:00 2001 From: Jeff Tao Date: Sat, 27 Jun 2020 08:31:24 +0000 Subject: [PATCH] memory leak if vnode not exist --- src/dnode/src/dnodeVRead.c | 1 + src/dnode/src/dnodeVWrite.c | 1 + src/rpc/src/rpcMain.c | 2 ++ src/rpc/src/rpcTcp.c | 2 ++ src/rpc/src/rpcUdp.c | 2 ++ 5 files changed, 8 insertions(+) diff --git a/src/dnode/src/dnodeVRead.c b/src/dnode/src/dnodeVRead.c index cd18ae6dda..3027a94411 100644 --- a/src/dnode/src/dnodeVRead.c +++ b/src/dnode/src/dnodeVRead.c @@ -131,6 +131,7 @@ void dnodeDispatchToVnodeReadQueue(SRpcMsg *pMsg) { .msgType = 0 }; rpcSendResponse(&rpcRsp); + rpcFreeCont(pMsg->pCont); } } diff --git a/src/dnode/src/dnodeVWrite.c b/src/dnode/src/dnodeVWrite.c index e61364355d..e2cc2d1cd3 100644 --- a/src/dnode/src/dnodeVWrite.c +++ b/src/dnode/src/dnodeVWrite.c @@ -119,6 +119,7 @@ void dnodeDispatchToVnodeWriteQueue(SRpcMsg *pMsg) { .msgType = 0 }; rpcSendResponse(&rpcRsp); + rpcFreeCont(pMsg->pCont); } } diff --git a/src/rpc/src/rpcMain.c b/src/rpc/src/rpcMain.c index e9ddd89467..5f30d27aeb 100644 --- a/src/rpc/src/rpcMain.c +++ b/src/rpc/src/rpcMain.c @@ -331,6 +331,7 @@ void rpcFreeCont(void *cont) { if ( cont ) { char *temp = ((char *)cont) - sizeof(SRpcHead) - sizeof(SRpcReqContext); free(temp); + // tTrace("free mem: %p", temp); } } @@ -540,6 +541,7 @@ static void rpcFreeMsg(void *msg) { if ( msg ) { char *temp = (char *)msg - sizeof(SRpcReqContext); free(temp); + // tTrace("free mem: %p", temp); } } diff --git a/src/rpc/src/rpcTcp.c b/src/rpc/src/rpcTcp.c index 82168f0b0e..c21a1e04df 100644 --- a/src/rpc/src/rpcTcp.c +++ b/src/rpc/src/rpcTcp.c @@ -418,6 +418,8 @@ static int taosReadTcpData(SFdObj *pFdObj, SRecvInfo *pInfo) { if ( NULL == buffer) { tError("%s %p TCP malloc(size:%d) fail", pThreadObj->label, pFdObj->thandle, msgLen); return -1; + } else { + // tTrace("malloc mem: %p", buffer); } msg = buffer + tsRpcOverhead; diff --git a/src/rpc/src/rpcUdp.c b/src/rpc/src/rpcUdp.c index a4c7d6c145..e92168c46a 100644 --- a/src/rpc/src/rpcUdp.c +++ b/src/rpc/src/rpcUdp.c @@ -211,6 +211,8 @@ static void *taosRecvUdpData(void *param) { if (NULL == tmsg) { tError("%s failed to allocate memory, size:%ld", pConn->label, dataLen); continue; + } else { + // tTrace("malloc mem: %p", tmsg); } tmsg += tsRpcOverhead; // overhead for SRpcReqContext -- GitLab