From db8e90076e10514f173806bfe5634ad87d9bb2a1 Mon Sep 17 00:00:00 2001 From: dapan1121 Date: Tue, 18 Oct 2022 17:58:37 +0800 Subject: [PATCH] fix: fix memory leak issue --- src/rpc/src/rpcMain.c | 7 +++++++ 1 file changed, 7 insertions(+) diff --git a/src/rpc/src/rpcMain.c b/src/rpc/src/rpcMain.c index 458a7d45a6..bf5b22eb76 100644 --- a/src/rpc/src/rpcMain.c +++ b/src/rpc/src/rpcMain.c @@ -1489,9 +1489,14 @@ static bool rpcSendMsgToPeer(SRpcConn *pConn, void *msg, int msgLen) { } static void rpcProcessConnError(void *param, void *id) { + if (NULL == param) { + return; + } + int64_t *rid = (int64_t*)param; SRpcReqContext *pContext = (SRpcReqContext *)taosAcquireRef(tsRpcRefId, *rid); if (NULL == pContext) { + free(param); return; } @@ -1500,6 +1505,7 @@ static void rpcProcessConnError(void *param, void *id) { if (pRpc == NULL) { taosReleaseRef(tsRpcRefId, *rid); + free(param); return; } @@ -1521,6 +1527,7 @@ static void rpcProcessConnError(void *param, void *id) { } taosReleaseRef(tsRpcRefId, *rid); + free(param); } static void rpcProcessRetryTimer(void *param, void *tmrId) { -- GitLab