From 0a782ef78c9b3fff48d5fd25c7c56f1698c5127a Mon Sep 17 00:00:00 2001 From: Minglei Jin Date: Wed, 22 Feb 2023 14:50:41 +0800 Subject: [PATCH] fix(mnd): coverity scan issues --- source/dnode/mnode/impl/src/mndConsumer.c | 2 ++ source/dnode/mnode/impl/src/mndDump.c | 2 +- source/dnode/mnode/impl/src/mndStream.c | 6 ++++-- 3 files changed, 7 insertions(+), 3 deletions(-) diff --git a/source/dnode/mnode/impl/src/mndConsumer.c b/source/dnode/mnode/impl/src/mndConsumer.c index eb4fc3cdad..568a50e10e 100644 --- a/source/dnode/mnode/impl/src/mndConsumer.c +++ b/source/dnode/mnode/impl/src/mndConsumer.c @@ -864,6 +864,8 @@ static int32_t mndConsumerActionUpdate(SSdb *pSdb, SMqConsumerObj *pOldConsumer, if (!existing) { taosArrayPush(pOldConsumer->currentTopics, &addedTopic); taosArraySort(pOldConsumer->currentTopics, taosArrayCompareString); + } else { + taosMemoryFree(addedTopic); } // set status diff --git a/source/dnode/mnode/impl/src/mndDump.c b/source/dnode/mnode/impl/src/mndDump.c index 7d0f5742f8..44a7d49fff 100644 --- a/source/dnode/mnode/impl/src/mndDump.c +++ b/source/dnode/mnode/impl/src/mndDump.c @@ -629,7 +629,7 @@ void mndDumpSdb() { } taosWriteFile(pFile, pCont, contLen); taosWriteFile(pFile, "\n", 1); - taosFsyncFile(pFile); + UNUSED(taosFsyncFile(pFile)); taosCloseFile(&pFile); tjsonDelete(json); taosMemoryFree(pCont); diff --git a/source/dnode/mnode/impl/src/mndStream.c b/source/dnode/mnode/impl/src/mndStream.c index 199266cd17..3cd57ec19c 100644 --- a/source/dnode/mnode/impl/src/mndStream.c +++ b/source/dnode/mnode/impl/src/mndStream.c @@ -722,8 +722,10 @@ static int32_t mndProcessCreateStreamReq(SRpcMsg *pReq) { mInfo("trans:%d, used to create stream:%s", pTrans->id, createStreamReq.name); mndTransSetDbName(pTrans, createStreamReq.sourceDB, streamObj.targetDb); - if (mndTrancCheckConflict(pMnode, pTrans) != 0) goto _OVER; - + if (mndTrancCheckConflict(pMnode, pTrans) != 0) { + mndTransDrop(pTrans); + goto _OVER; + } // create stb for stream if (createStreamReq.createStb == STREAM_CREATE_STABLE_TRUE && mndCreateStbForStream(pMnode, pTrans, &streamObj, pReq->info.conn.user) < 0) { -- GitLab