From e30b74ad5ab105b1d7794ae976c1172d4dae16f8 Mon Sep 17 00:00:00 2001 From: Liu Jicong Date: Mon, 8 Aug 2022 18:20:41 +0800 Subject: [PATCH] fix(stream): memory leak --- source/dnode/vnode/src/vnd/vnodeSync.c | 6 +++++- source/libs/stream/src/streamDispatch.c | 3 +-- 2 files changed, 6 insertions(+), 3 deletions(-) diff --git a/source/dnode/vnode/src/vnd/vnodeSync.c b/source/dnode/vnode/src/vnd/vnodeSync.c index a269f81ddd..d819cf92b7 100644 --- a/source/dnode/vnode/src/vnd/vnodeSync.c +++ b/source/dnode/vnode/src/vnd/vnodeSync.c @@ -299,6 +299,10 @@ void vnodeApplyWriteMsg(SQueueInfo *pInfo, STaosQall *qall, int32_t numOfMsgs) { vnodePostBlockMsg(pVnode, pMsg); if (rsp.info.handle != NULL) { tmsgSendRsp(&rsp); + } else { + if (rsp.pCont) { + rpcFreeCont(rsp.pCont); + } } vGTrace("vgId:%d, msg:%p is freed, code:0x%x index:%" PRId64, vgId, pMsg, rsp.code, pMsg->info.conn.applyIndex); @@ -731,4 +735,4 @@ bool vnodeIsLeader(SVnode *pVnode) { } return true; -} \ No newline at end of file +} diff --git a/source/libs/stream/src/streamDispatch.c b/source/libs/stream/src/streamDispatch.c index 8b5e6355a2..9d98afa65a 100644 --- a/source/libs/stream/src/streamDispatch.c +++ b/source/libs/stream/src/streamDispatch.c @@ -65,7 +65,6 @@ int32_t tDecodeStreamDispatchReq(SDecoder* pDecoder, SStreamDispatchReq* pReq) { void tFreeStreamDispatchReq(SStreamDispatchReq* pReq) { taosArrayDestroyP(pReq->data, taosMemoryFree); taosArrayDestroy(pReq->dataLen); - taosMemoryFree(pReq); } int32_t tEncodeStreamRetrieveReq(SEncoder* pEncoder, const SStreamRetrieveReq* pReq) { @@ -285,7 +284,7 @@ int32_t streamDispatchAllBlocks(SStreamTask* pTask, const SStreamDataBlock* pDat } code = 0; FAIL_FIXED_DISPATCH: - taosArrayDestroy(req.data); + taosArrayDestroyP(req.data, taosMemoryFree); taosArrayDestroy(req.dataLen); return code; -- GitLab