diff --git a/source/dnode/mnode/impl/src/mndAcct.c b/source/dnode/mnode/impl/src/mndAcct.c index ffa5dc6d0bdb1ce6589bf3f73dbe22f9d0d455b8..ce2ec7b23aaaff451b44f470125abf8e8fb87331 100644 --- a/source/dnode/mnode/impl/src/mndAcct.c +++ b/source/dnode/mnode/impl/src/mndAcct.c @@ -147,6 +147,8 @@ _OVER: static SSdbRow *mndAcctActionDecode(SSdbRaw *pRaw) { terrno = TSDB_CODE_OUT_OF_MEMORY; + SAcctObj *pAcct = NULL; + SSdbRow *pRow = NULL; int8_t sver = 0; if (sdbGetRawSoftVer(pRaw, &sver) != 0) goto _OVER; @@ -156,10 +158,10 @@ static SSdbRow *mndAcctActionDecode(SSdbRaw *pRaw) { goto _OVER; } - SSdbRow *pRow = sdbAllocRow(sizeof(SAcctObj)); + pRow = sdbAllocRow(sizeof(SAcctObj)); if (pRow == NULL) goto _OVER; - SAcctObj *pAcct = sdbGetRowObj(pRow); + pAcct = sdbGetRowObj(pRow); if (pAcct == NULL) goto _OVER; int32_t dataPos = 0; @@ -186,7 +188,7 @@ static SSdbRow *mndAcctActionDecode(SSdbRaw *pRaw) { _OVER: if (terrno != 0) { - mError("acct:%s, failed to decode from raw:%p since %s", pAcct->acct, pRaw, terrstr()); + mError("acct:%s, failed to decode from raw:%p since %s", pAcct == NULL ? "null" : pAcct->acct, pRaw, terrstr()); taosMemoryFreeClear(pRow); return NULL; } diff --git a/source/dnode/mnode/impl/src/mndCluster.c b/source/dnode/mnode/impl/src/mndCluster.c index 348c8f4cb857da63f4ec3976004046b909e96eee..ca03207d2b95bab562c48a02ca383d67bba7349d 100644 --- a/source/dnode/mnode/impl/src/mndCluster.c +++ b/source/dnode/mnode/impl/src/mndCluster.c @@ -157,6 +157,8 @@ _OVER: static SSdbRow *mndClusterActionDecode(SSdbRaw *pRaw) { terrno = TSDB_CODE_OUT_OF_MEMORY; + SClusterObj *pCluster = NULL; + SSdbRow *pRow = NULL; int8_t sver = 0; if (sdbGetRawSoftVer(pRaw, &sver) != 0) goto _OVER; @@ -166,10 +168,10 @@ static SSdbRow *mndClusterActionDecode(SSdbRaw *pRaw) { goto _OVER; } - SSdbRow *pRow = sdbAllocRow(sizeof(SClusterObj)); + pRow = sdbAllocRow(sizeof(SClusterObj)); if (pRow == NULL) goto _OVER; - SClusterObj *pCluster = sdbGetRowObj(pRow); + pCluster = sdbGetRowObj(pRow); if (pCluster == NULL) goto _OVER; int32_t dataPos = 0; @@ -184,7 +186,8 @@ static SSdbRow *mndClusterActionDecode(SSdbRaw *pRaw) { _OVER: if (terrno != 0) { - mError("cluster:%" PRId64 ", failed to decode from raw:%p since %s", pCluster->id, pRaw, terrstr()); + mError("cluster:%" PRId64 ", failed to decode from raw:%p since %s", pCluster == NULL ? 0 : pCluster->id, pRaw, + terrstr()); taosMemoryFreeClear(pRow); return NULL; } diff --git a/source/dnode/mnode/impl/src/mndConsumer.c b/source/dnode/mnode/impl/src/mndConsumer.c index 4397ea075100faf302895b7f397aa981462fcd6e..76bff9a70ff9ba09d852ada451d83cbdc397c0ca 100644 --- a/source/dnode/mnode/impl/src/mndConsumer.c +++ b/source/dnode/mnode/impl/src/mndConsumer.c @@ -712,7 +712,9 @@ CM_ENCODE_OVER: SSdbRow *mndConsumerActionDecode(SSdbRaw *pRaw) { terrno = TSDB_CODE_OUT_OF_MEMORY; - void *buf = NULL; + SSdbRow *pRow = NULL; + SMqConsumerObj *pConsumer = NULL; + void *buf = NULL; int8_t sver = 0; if (sdbGetRawSoftVer(pRaw, &sver) != 0) goto CM_DECODE_OVER; @@ -722,10 +724,10 @@ SSdbRow *mndConsumerActionDecode(SSdbRaw *pRaw) { goto CM_DECODE_OVER; } - SSdbRow *pRow = sdbAllocRow(sizeof(SMqConsumerObj)); + pRow = sdbAllocRow(sizeof(SMqConsumerObj)); if (pRow == NULL) goto CM_DECODE_OVER; - SMqConsumerObj *pConsumer = sdbGetRowObj(pRow); + pConsumer = sdbGetRowObj(pRow); if (pConsumer == NULL) goto CM_DECODE_OVER; int32_t dataPos = 0; @@ -745,7 +747,8 @@ SSdbRow *mndConsumerActionDecode(SSdbRaw *pRaw) { CM_DECODE_OVER: taosMemoryFreeClear(buf); if (terrno != TSDB_CODE_SUCCESS) { - mError("consumer:%" PRId64 ", failed to decode from raw:%p since %s", pConsumer->consumerId, pRaw, terrstr()); + mError("consumer:%" PRId64 ", failed to decode from raw:%p since %s", pConsumer == NULL ? 0 : pConsumer->consumerId, + pRaw, terrstr()); taosMemoryFreeClear(pRow); return NULL; } diff --git a/source/dnode/mnode/impl/src/mndDb.c b/source/dnode/mnode/impl/src/mndDb.c index c5d5687adedea8ea0b43c7acc1d1cfcf1f9d8790..5fa86dffe289ad7410cc9cbc7b58edf800bba966 100644 --- a/source/dnode/mnode/impl/src/mndDb.c +++ b/source/dnode/mnode/impl/src/mndDb.c @@ -147,6 +147,8 @@ _OVER: static SSdbRow *mndDbActionDecode(SSdbRaw *pRaw) { terrno = TSDB_CODE_OUT_OF_MEMORY; + SSdbRow *pRow = NULL; + SDbObj *pDb = NULL; int8_t sver = 0; if (sdbGetRawSoftVer(pRaw, &sver) != 0) goto _OVER; @@ -156,10 +158,10 @@ static SSdbRow *mndDbActionDecode(SSdbRaw *pRaw) { goto _OVER; } - SSdbRow *pRow = sdbAllocRow(sizeof(SDbObj)); + pRow = sdbAllocRow(sizeof(SDbObj)); if (pRow == NULL) goto _OVER; - SDbObj *pDb = sdbGetRowObj(pRow); + pDb = sdbGetRowObj(pRow); if (pDb == NULL) goto _OVER; int32_t dataPos = 0; @@ -232,7 +234,7 @@ static SSdbRow *mndDbActionDecode(SSdbRaw *pRaw) { _OVER: if (terrno != 0) { - mError("db:%s, failed to decode from raw:%p since %s", pDb->name, pRaw, terrstr()); + mError("db:%s, failed to decode from raw:%p since %s", pDb == NULL ? "null" : pDb->name, pRaw, terrstr()); taosMemoryFreeClear(pRow); return NULL; } diff --git a/source/dnode/mnode/impl/src/mndDnode.c b/source/dnode/mnode/impl/src/mndDnode.c index 2a3ecf1924654ebbc5c589f65a0d291e9754b0fa..8939182658dd20bd63e2da4a8a5c926e798ac6c8 100644 --- a/source/dnode/mnode/impl/src/mndDnode.c +++ b/source/dnode/mnode/impl/src/mndDnode.c @@ -154,8 +154,9 @@ _OVER: } static SSdbRow *mndDnodeActionDecode(SSdbRaw *pRaw) { - SSdbRow *pRow = NULL; terrno = TSDB_CODE_OUT_OF_MEMORY; + SSdbRow *pRow = NULL; + SDnodeObj *pDnode = NULL; int8_t sver = 0; if (sdbGetRawSoftVer(pRaw, &sver) != 0) goto _OVER; @@ -166,7 +167,8 @@ static SSdbRow *mndDnodeActionDecode(SSdbRaw *pRaw) { pRow = sdbAllocRow(sizeof(SDnodeObj)); if (pRow == NULL) goto _OVER; - SDnodeObj *pDnode = sdbGetRowObj(pRow); + + pDnode = sdbGetRowObj(pRow); if (pDnode == NULL) goto _OVER; int32_t dataPos = 0; @@ -181,7 +183,7 @@ static SSdbRow *mndDnodeActionDecode(SSdbRaw *pRaw) { _OVER: if (terrno != 0) { - mError("dnode:%d, failed to decode from raw:%p since %s", pDnode->id, pRaw, terrstr()); + mError("dnode:%d, failed to decode from raw:%p since %s", pDnode == NULL ? 0 : pDnode->id, pRaw, terrstr()); taosMemoryFreeClear(pRow); return NULL; } diff --git a/source/dnode/mnode/impl/src/mndFunc.c b/source/dnode/mnode/impl/src/mndFunc.c index c9b22fad3aa71e5881a821a4b1f84464f8d120c4..31f31a15baf31813aeb071ff933ff5263d5976f8 100644 --- a/source/dnode/mnode/impl/src/mndFunc.c +++ b/source/dnode/mnode/impl/src/mndFunc.c @@ -101,6 +101,8 @@ _OVER: static SSdbRow *mndFuncActionDecode(SSdbRaw *pRaw) { terrno = TSDB_CODE_OUT_OF_MEMORY; + SSdbRow *pRow = NULL; + SFuncObj *pFunc = NULL; int8_t sver = 0; if (sdbGetRawSoftVer(pRaw, &sver) != 0) goto _OVER; @@ -110,10 +112,10 @@ static SSdbRow *mndFuncActionDecode(SSdbRaw *pRaw) { goto _OVER; } - SSdbRow *pRow = sdbAllocRow(sizeof(SFuncObj)); + pRow = sdbAllocRow(sizeof(SFuncObj)); if (pRow == NULL) goto _OVER; - SFuncObj *pFunc = sdbGetRowObj(pRow); + pFunc = sdbGetRowObj(pRow); if (pFunc == NULL) goto _OVER; int32_t dataPos = 0; @@ -148,7 +150,7 @@ static SSdbRow *mndFuncActionDecode(SSdbRaw *pRaw) { _OVER: if (terrno != 0) { - mError("func:%s, failed to decode from raw:%p since %s", pFunc->name, pRaw, terrstr()); + mError("func:%s, failed to decode from raw:%p since %s", pFunc == NULL ? "null" : pFunc->name, pRaw, terrstr()); taosMemoryFreeClear(pRow); return NULL; } diff --git a/source/dnode/mnode/impl/src/mndMnode.c b/source/dnode/mnode/impl/src/mndMnode.c index 7c86a5be22f139940a9eab2d9bbe864a99c57729..2620100b6ca46cdebaa64cc892bcbdf697c5f458 100644 --- a/source/dnode/mnode/impl/src/mndMnode.c +++ b/source/dnode/mnode/impl/src/mndMnode.c @@ -142,6 +142,8 @@ _OVER: static SSdbRow *mndMnodeActionDecode(SSdbRaw *pRaw) { terrno = TSDB_CODE_OUT_OF_MEMORY; + SSdbRow *pRow = NULL; + SMnodeObj *pObj = NULL; int8_t sver = 0; if (sdbGetRawSoftVer(pRaw, &sver) != 0) return NULL; @@ -151,10 +153,10 @@ static SSdbRow *mndMnodeActionDecode(SSdbRaw *pRaw) { goto _OVER; } - SSdbRow *pRow = sdbAllocRow(sizeof(SMnodeObj)); + pRow = sdbAllocRow(sizeof(SMnodeObj)); if (pRow == NULL) goto _OVER; - SMnodeObj *pObj = sdbGetRowObj(pRow); + pObj = sdbGetRowObj(pRow); if (pObj == NULL) goto _OVER; int32_t dataPos = 0; @@ -167,7 +169,7 @@ static SSdbRow *mndMnodeActionDecode(SSdbRaw *pRaw) { _OVER: if (terrno != 0) { - mError("mnode:%d, failed to decode from raw:%p since %s", pObj->id, pRaw, terrstr()); + mError("mnode:%d, failed to decode from raw:%p since %s", pObj == NULL ? 0 : pObj->id, pRaw, terrstr()); taosMemoryFreeClear(pRow); return NULL; } diff --git a/source/dnode/mnode/impl/src/mndQnode.c b/source/dnode/mnode/impl/src/mndQnode.c index 434e6fbc52d9754cbc6fac929a94965fe8e3a63d..26e7f72cf72eb792e07aa1dc6c49b80f2c612497 100644 --- a/source/dnode/mnode/impl/src/mndQnode.c +++ b/source/dnode/mnode/impl/src/mndQnode.c @@ -100,6 +100,8 @@ _OVER: static SSdbRow *mndQnodeActionDecode(SSdbRaw *pRaw) { terrno = TSDB_CODE_OUT_OF_MEMORY; + SSdbRow *pRow = NULL; + SQnodeObj *pObj = NULL; int8_t sver = 0; if (sdbGetRawSoftVer(pRaw, &sver) != 0) goto _OVER; @@ -109,10 +111,10 @@ static SSdbRow *mndQnodeActionDecode(SSdbRaw *pRaw) { goto _OVER; } - SSdbRow *pRow = sdbAllocRow(sizeof(SQnodeObj)); + pRow = sdbAllocRow(sizeof(SQnodeObj)); if (pRow == NULL) goto _OVER; - SQnodeObj *pObj = sdbGetRowObj(pRow); + pObj = sdbGetRowObj(pRow); if (pObj == NULL) goto _OVER; int32_t dataPos = 0; @@ -125,7 +127,7 @@ static SSdbRow *mndQnodeActionDecode(SSdbRaw *pRaw) { _OVER: if (terrno != 0) { - mError("qnode:%d, failed to decode from raw:%p since %s", pObj->id, pRaw, terrstr()); + mError("qnode:%d, failed to decode from raw:%p since %s", pObj == NULL ? 0 : pObj->id, pRaw, terrstr()); taosMemoryFreeClear(pRow); return NULL; } diff --git a/source/dnode/mnode/impl/src/mndSma.c b/source/dnode/mnode/impl/src/mndSma.c index 698c07d9bc95b0866b49f87b42a8de0e7b8e3dfb..7be2d48c703c5c80df4fea6a7d8c5c411dc429d4 100644 --- a/source/dnode/mnode/impl/src/mndSma.c +++ b/source/dnode/mnode/impl/src/mndSma.c @@ -132,6 +132,8 @@ _OVER: static SSdbRow *mndSmaActionDecode(SSdbRaw *pRaw) { terrno = TSDB_CODE_OUT_OF_MEMORY; + SSdbRow *pRow = NULL; + SSmaObj *pSma = NULL; int8_t sver = 0; if (sdbGetRawSoftVer(pRaw, &sver) != 0) goto _OVER; @@ -141,10 +143,10 @@ static SSdbRow *mndSmaActionDecode(SSdbRaw *pRaw) { goto _OVER; } - SSdbRow *pRow = sdbAllocRow(sizeof(SSmaObj)); + pRow = sdbAllocRow(sizeof(SSmaObj)); if (pRow == NULL) goto _OVER; - SSmaObj *pSma = sdbGetRowObj(pRow); + pSma = sdbGetRowObj(pRow); if (pSma == NULL) goto _OVER; int32_t dataPos = 0; @@ -200,7 +202,7 @@ static SSdbRow *mndSmaActionDecode(SSdbRaw *pRaw) { _OVER: if (terrno != 0) { - mError("sma:%s, failed to decode from raw:%p since %s", pSma->name, pRaw, terrstr()); + mError("sma:%s, failed to decode from raw:%p since %s", pSma == NULL ? "null" : pSma->name, pRaw, terrstr()); taosMemoryFreeClear(pSma->expr); taosMemoryFreeClear(pSma->tagsFilter); taosMemoryFreeClear(pSma->sql); diff --git a/source/dnode/mnode/impl/src/mndSnode.c b/source/dnode/mnode/impl/src/mndSnode.c index 7753e5b1279b310fb97955c61343c9ce3cca681e..a31801f3767b60d0a72243c3c0c8957d0ce98818 100644 --- a/source/dnode/mnode/impl/src/mndSnode.c +++ b/source/dnode/mnode/impl/src/mndSnode.c @@ -105,6 +105,8 @@ _OVER: static SSdbRow *mndSnodeActionDecode(SSdbRaw *pRaw) { terrno = TSDB_CODE_OUT_OF_MEMORY; + SSdbRow *pRow = NULL; + SSnodeObj *pObj = NULL; int8_t sver = 0; if (sdbGetRawSoftVer(pRaw, &sver) != 0) goto _OVER; @@ -114,10 +116,10 @@ static SSdbRow *mndSnodeActionDecode(SSdbRaw *pRaw) { goto _OVER; } - SSdbRow *pRow = sdbAllocRow(sizeof(SSnodeObj)); + pRow = sdbAllocRow(sizeof(SSnodeObj)); if (pRow == NULL) goto _OVER; - SSnodeObj *pObj = sdbGetRowObj(pRow); + pObj = sdbGetRowObj(pRow); if (pObj == NULL) goto _OVER; int32_t dataPos = 0; @@ -130,7 +132,7 @@ static SSdbRow *mndSnodeActionDecode(SSdbRaw *pRaw) { _OVER: if (terrno != 0) { - mError("snode:%d, failed to decode from raw:%p since %s", pObj->id, pRaw, terrstr()); + mError("snode:%d, failed to decode from raw:%p since %s", pObj == NULL ? 0 : pObj->id, pRaw, terrstr()); taosMemoryFreeClear(pRow); return NULL; } diff --git a/source/dnode/mnode/impl/src/mndStb.c b/source/dnode/mnode/impl/src/mndStb.c index 6dad7d74c833c76d8512c68abae3a0653d09b86a..2ed4fde50963418af86be25a32f10f9e609c00e9 100644 --- a/source/dnode/mnode/impl/src/mndStb.c +++ b/source/dnode/mnode/impl/src/mndStb.c @@ -162,6 +162,8 @@ _OVER: static SSdbRow *mndStbActionDecode(SSdbRaw *pRaw) { terrno = TSDB_CODE_OUT_OF_MEMORY; + SSdbRow *pRow = NULL; + SStbObj *pStb = NULL; int8_t sver = 0; if (sdbGetRawSoftVer(pRaw, &sver) != 0) goto _OVER; @@ -171,10 +173,10 @@ static SSdbRow *mndStbActionDecode(SSdbRaw *pRaw) { goto _OVER; } - SSdbRow *pRow = sdbAllocRow(sizeof(SStbObj)); + pRow = sdbAllocRow(sizeof(SStbObj)); if (pRow == NULL) goto _OVER; - SStbObj *pStb = sdbGetRowObj(pRow); + pStb = sdbGetRowObj(pRow); if (pStb == NULL) goto _OVER; int32_t dataPos = 0; @@ -254,10 +256,12 @@ static SSdbRow *mndStbActionDecode(SSdbRaw *pRaw) { _OVER: if (terrno != 0) { - mError("stb:%s, failed to decode from raw:%p since %s", pStb->name, pRaw, terrstr()); - taosMemoryFreeClear(pStb->pColumns); - taosMemoryFreeClear(pStb->pTags); - taosMemoryFreeClear(pStb->comment); + mError("stb:%s, failed to decode from raw:%p since %s", pStb == NULL ? "null" : pStb->name, pRaw, terrstr()); + if (pStb != NULL) { + taosMemoryFreeClear(pStb->pColumns); + taosMemoryFreeClear(pStb->pTags); + taosMemoryFreeClear(pStb->comment); + } taosMemoryFreeClear(pRow); return NULL; } diff --git a/source/dnode/mnode/impl/src/mndStream.c b/source/dnode/mnode/impl/src/mndStream.c index d8cf7a837eb282a1be4444470445d20db6d9fbba..44ff8733fd326e3c28fa1481cbe6f95b06d2c8af 100644 --- a/source/dnode/mnode/impl/src/mndStream.c +++ b/source/dnode/mnode/impl/src/mndStream.c @@ -120,7 +120,9 @@ STREAM_ENCODE_OVER: SSdbRow *mndStreamActionDecode(SSdbRaw *pRaw) { terrno = TSDB_CODE_OUT_OF_MEMORY; - void *buf = NULL; + SSdbRow *pRow = NULL; + SStreamObj *pStream = NULL; + void *buf = NULL; int8_t sver = 0; if (sdbGetRawSoftVer(pRaw, &sver) != 0) goto STREAM_DECODE_OVER; @@ -130,11 +132,10 @@ SSdbRow *mndStreamActionDecode(SSdbRaw *pRaw) { goto STREAM_DECODE_OVER; } - int32_t size = sizeof(SStreamObj); - SSdbRow *pRow = sdbAllocRow(size); + pRow = sdbAllocRow(sizeof(SStreamObj)); if (pRow == NULL) goto STREAM_DECODE_OVER; - SStreamObj *pStream = sdbGetRowObj(pRow); + pStream = sdbGetRowObj(pRow); if (pStream == NULL) goto STREAM_DECODE_OVER; int32_t tlen; @@ -157,7 +158,7 @@ SSdbRow *mndStreamActionDecode(SSdbRaw *pRaw) { STREAM_DECODE_OVER: taosMemoryFreeClear(buf); if (terrno != TSDB_CODE_SUCCESS) { - mError("stream:%s, failed to decode from raw:%p since %s", pStream->name, pRaw, terrstr()); + mError("stream:%s, failed to decode from raw:%p since %s", pStream == NULL ? "null" : pStream->name, pRaw, terrstr()); taosMemoryFreeClear(pRow); return NULL; } diff --git a/source/dnode/mnode/impl/src/mndSubscribe.c b/source/dnode/mnode/impl/src/mndSubscribe.c index ffb46e5f1b7e085d00e9a4f69e667c44a8db9fa7..3cf5e17cd3606b46f50667e15a27a8ade843a867 100644 --- a/source/dnode/mnode/impl/src/mndSubscribe.c +++ b/source/dnode/mnode/impl/src/mndSubscribe.c @@ -743,7 +743,9 @@ SUB_ENCODE_OVER: static SSdbRow *mndSubActionDecode(SSdbRaw *pRaw) { terrno = TSDB_CODE_OUT_OF_MEMORY; - void *buf = NULL; + SSdbRow *pRow = NULL; + SMqSubscribeObj *pSub = NULL; + void *buf = NULL; int8_t sver = 0; if (sdbGetRawSoftVer(pRaw, &sver) != 0) goto SUB_DECODE_OVER; @@ -753,11 +755,10 @@ static SSdbRow *mndSubActionDecode(SSdbRaw *pRaw) { goto SUB_DECODE_OVER; } - int32_t size = sizeof(SMqSubscribeObj); - SSdbRow *pRow = sdbAllocRow(size); + pRow = sdbAllocRow(sizeof(SMqSubscribeObj)); if (pRow == NULL) goto SUB_DECODE_OVER; - SMqSubscribeObj *pSub = sdbGetRowObj(pRow); + pSub = sdbGetRowObj(pRow); if (pSub == NULL) goto SUB_DECODE_OVER; int32_t dataPos = 0; @@ -777,7 +778,7 @@ static SSdbRow *mndSubActionDecode(SSdbRaw *pRaw) { SUB_DECODE_OVER: taosMemoryFreeClear(buf); if (terrno != TSDB_CODE_SUCCESS) { - mError("subscribe:%s, failed to decode from raw:%p since %s", pSub->key, pRaw, terrstr()); + mError("subscribe:%s, failed to decode from raw:%p since %s", pSub == NULL ? "null" : pSub->key, pRaw, terrstr()); taosMemoryFreeClear(pRow); return NULL; } diff --git a/source/dnode/mnode/impl/src/mndTopic.c b/source/dnode/mnode/impl/src/mndTopic.c index aabb2e5087a50b49f757cb159e292ebf040a87d5..eea74c6dd823faaa3467a87733db5ffe22528ac9 100644 --- a/source/dnode/mnode/impl/src/mndTopic.c +++ b/source/dnode/mnode/impl/src/mndTopic.c @@ -152,8 +152,10 @@ TOPIC_ENCODE_OVER: SSdbRow *mndTopicActionDecode(SSdbRaw *pRaw) { terrno = TSDB_CODE_OUT_OF_MEMORY; + SSdbRow *pRow = NULL; + SMqTopicObj *pTopic = NULL; + void *buf = NULL; - void *buf = NULL; int8_t sver = 0; if (sdbGetRawSoftVer(pRaw, &sver) != 0) goto TOPIC_DECODE_OVER; @@ -162,11 +164,10 @@ SSdbRow *mndTopicActionDecode(SSdbRaw *pRaw) { goto TOPIC_DECODE_OVER; } - int32_t size = sizeof(SMqTopicObj); - SSdbRow *pRow = sdbAllocRow(size); + pRow = sdbAllocRow(sizeof(SMqTopicObj)); if (pRow == NULL) goto TOPIC_DECODE_OVER; - SMqTopicObj *pTopic = sdbGetRowObj(pRow); + pTopic = sdbGetRowObj(pRow); if (pTopic == NULL) goto TOPIC_DECODE_OVER; int32_t len; @@ -251,7 +252,7 @@ SSdbRow *mndTopicActionDecode(SSdbRaw *pRaw) { TOPIC_DECODE_OVER: taosMemoryFreeClear(buf); if (terrno != TSDB_CODE_SUCCESS) { - mError("topic:%s, failed to decode from raw:%p since %s", pTopic->name, pRaw, terrstr()); + mError("topic:%s, failed to decode from raw:%p since %s", pTopic == NULL ? "null" : pTopic->name, pRaw, terrstr()); taosMemoryFreeClear(pRow); return NULL; } diff --git a/source/dnode/mnode/impl/src/mndUser.c b/source/dnode/mnode/impl/src/mndUser.c index fd0a04f2e74d60e425e60c0ba57422b1846954d2..5f34adce7790112cd1f22917f81f4308e6369cf3 100644 --- a/source/dnode/mnode/impl/src/mndUser.c +++ b/source/dnode/mnode/impl/src/mndUser.c @@ -182,6 +182,8 @@ _OVER: static SSdbRow *mndUserActionDecode(SSdbRaw *pRaw) { terrno = TSDB_CODE_OUT_OF_MEMORY; + SSdbRow *pRow = NULL; + SUserObj *pUser = NULL; int8_t sver = 0; if (sdbGetRawSoftVer(pRaw, &sver) != 0) goto _OVER; @@ -191,10 +193,10 @@ static SSdbRow *mndUserActionDecode(SSdbRaw *pRaw) { goto _OVER; } - SSdbRow *pRow = sdbAllocRow(sizeof(SUserObj)); + pRow = sdbAllocRow(sizeof(SUserObj)); if (pRow == NULL) goto _OVER; - SUserObj *pUser = sdbGetRowObj(pRow); + pUser = sdbGetRowObj(pRow); if (pUser == NULL) goto _OVER; int32_t dataPos = 0; @@ -254,10 +256,12 @@ static SSdbRow *mndUserActionDecode(SSdbRaw *pRaw) { _OVER: if (terrno != 0) { - mError("user:%s, failed to decode from raw:%p since %s", pUser->user, pRaw, terrstr()); - taosHashCleanup(pUser->readDbs); - taosHashCleanup(pUser->writeDbs); - taosHashCleanup(pUser->topics); + mError("user:%s, failed to decode from raw:%p since %s", pUser == NULL ? "null" : pUser->user, pRaw, terrstr()); + if (pUser != NULL) { + taosHashCleanup(pUser->readDbs); + taosHashCleanup(pUser->writeDbs); + taosHashCleanup(pUser->topics); + } taosMemoryFreeClear(pRow); return NULL; } diff --git a/source/dnode/mnode/impl/src/mndVgroup.c b/source/dnode/mnode/impl/src/mndVgroup.c index d06853e47054c3ff9ff25bd2aa7af3ca90e544e8..99ea661eb7c8422f68ebee83006c6b2914f387e9 100644 --- a/source/dnode/mnode/impl/src/mndVgroup.c +++ b/source/dnode/mnode/impl/src/mndVgroup.c @@ -113,6 +113,8 @@ _OVER: SSdbRow *mndVgroupActionDecode(SSdbRaw *pRaw) { terrno = TSDB_CODE_OUT_OF_MEMORY; + SSdbRow *pRow = NULL; + SVgObj *pVgroup = NULL; int8_t sver = 0; if (sdbGetRawSoftVer(pRaw, &sver) != 0) goto _OVER; @@ -122,10 +124,10 @@ SSdbRow *mndVgroupActionDecode(SSdbRaw *pRaw) { goto _OVER; } - SSdbRow *pRow = sdbAllocRow(sizeof(SVgObj)); + pRow = sdbAllocRow(sizeof(SVgObj)); if (pRow == NULL) goto _OVER; - SVgObj *pVgroup = sdbGetRowObj(pRow); + pVgroup = sdbGetRowObj(pRow); if (pVgroup == NULL) goto _OVER; int32_t dataPos = 0; @@ -152,7 +154,7 @@ SSdbRow *mndVgroupActionDecode(SSdbRaw *pRaw) { _OVER: if (terrno != 0) { - mError("vgId:%d, failed to decode from raw:%p since %s", pVgroup->vgId, pRaw, terrstr()); + mError("vgId:%d, failed to decode from raw:%p since %s", pVgroup == NULL ? 0 : pVgroup->vgId, pRaw, terrstr()); taosMemoryFreeClear(pRow); return NULL; } diff --git a/tests/script/tsim/user/privilege_db.sim b/tests/script/tsim/user/privilege_db.sim index 83933e0e47f0e99ea5f9074db9bc463277ce578c..79e3754c2fe64b0978c172c6acec17becefe5cb8 100644 --- a/tests/script/tsim/user/privilege_db.sim +++ b/tests/script/tsim/user/privilege_db.sim @@ -5,6 +5,10 @@ sql connect print =============== create db sql create database d1 vgroups 1; +sql use d1 +sql create table stb (ts timestamp, i int) tags (j int) +sql create topic topic_1 as select ts, i from stb + sql create database d2 vgroups 1; sql create database d3 vgroups 1; sql select * from information_schema.ins_databases @@ -89,5 +93,6 @@ sql_error drop database d2; sql_error create stable d1.st (ts timestamp, i int) tags (j int) sql create stable d2.st (ts timestamp, i int) tags (j int) +sql_error create topic topic_2 as select ts, i from stb system sh/exec.sh -n dnode1 -s stop -x SIGINT