From ce2fc8b319b52d249348e55a394f7257ae029a50 Mon Sep 17 00:00:00 2001 From: wangmm0220 Date: Thu, 21 Sep 2023 10:05:52 +0800 Subject: [PATCH] fix:memory leak --- source/dnode/mnode/impl/src/mndSubscribe.c | 5 ++++- 1 file changed, 4 insertions(+), 1 deletion(-) diff --git a/source/dnode/mnode/impl/src/mndSubscribe.c b/source/dnode/mnode/impl/src/mndSubscribe.c index de3866f974..408b664e50 100644 --- a/source/dnode/mnode/impl/src/mndSubscribe.c +++ b/source/dnode/mnode/impl/src/mndSubscribe.c @@ -398,6 +398,7 @@ static int32_t processRemoveAddVgs(SMnode *pMnode, SMqRebOutputObj *pOutput){ for(int32_t k = 0; k < taosArrayGetSize(newVgs); k++){ SMqVgEp *pnewVgEp = taosArrayGetP(newVgs, k); if(pVgEp->vgId == pnewVgEp->vgId){ + tDeleteSMqVgEp(pnewVgEp); taosArrayRemove(newVgs, k); find = true; break; @@ -416,8 +417,10 @@ static int32_t processRemoveAddVgs(SMnode *pMnode, SMqRebOutputObj *pOutput){ if(taosArrayGetSize(pOutput->pSub->unassignedVgs) == 0 && taosArrayGetSize(newVgs) != 0){ taosArrayAddAll(pOutput->pSub->unassignedVgs, newVgs); mInfo("processRemoveAddVgs add new vg num:%d", (int)taosArrayGetSize(newVgs)); + taosArrayDestroy(newVgs); + }else{ + taosArrayDestroyP(newVgs, (FDelete)tDeleteSMqVgEp); } - taosArrayDestroyP(newVgs, (FDelete)tDeleteSMqVgEp); return totalVgNum; }