diff --git a/source/libs/catalog/src/catalog.c b/source/libs/catalog/src/catalog.c index 98d40930aca412f9b8b65ebded5d79d9754e036e..4afebf9951db2a895ef4b8c728e7b99fe979ce35 100644 --- a/source/libs/catalog/src/catalog.c +++ b/source/libs/catalog/src/catalog.c @@ -327,31 +327,28 @@ int32_t ctgChkAuth(SCatalog* pCtg, void *pTrans, const SEpSet* pMgmtEps, const c return TSDB_CODE_SUCCESS; } - SGetUserAuthRsp* authRsp = taosMemoryCalloc(1, sizeof(SGetUserAuthRsp)); - if (NULL == authRsp) { - CTG_ERR_RET(TSDB_CODE_OUT_OF_MEMORY); - } - CTG_ERR_RET(ctgGetUserDbAuthFromMnode(CTG_PARAMS_LIST(), user, authRsp, NULL)); + SGetUserAuthRsp authRsp = {0}; + CTG_ERR_RET(ctgGetUserDbAuthFromMnode(CTG_PARAMS_LIST(), user, &authRsp, NULL)); - if (authRsp->superAuth) { + if (authRsp.superAuth) { *pass = true; goto _return; } - if (authRsp->createdDbs && taosHashGet(authRsp->createdDbs, dbFName, strlen(dbFName))) { + if (authRsp.createdDbs && taosHashGet(authRsp.createdDbs, dbFName, strlen(dbFName))) { *pass = true; goto _return; } - if (type == AUTH_TYPE_READ && authRsp->readDbs && taosHashGet(authRsp->readDbs, dbFName, strlen(dbFName))) { + if (type == AUTH_TYPE_READ && authRsp.readDbs && taosHashGet(authRsp.readDbs, dbFName, strlen(dbFName))) { *pass = true; - } else if (type == AUTH_TYPE_WRITE && authRsp->writeDbs && taosHashGet(authRsp->writeDbs, dbFName, strlen(dbFName))) { + } else if (type == AUTH_TYPE_WRITE && authRsp.writeDbs && taosHashGet(authRsp.writeDbs, dbFName, strlen(dbFName))) { *pass = true; } _return: - ctgPutUpdateUserToQueue(pCtg, authRsp, false); + ctgPutUpdateUserToQueue(pCtg, &authRsp, false); return TSDB_CODE_SUCCESS; } diff --git a/source/libs/catalog/src/ctgAsync.c b/source/libs/catalog/src/ctgAsync.c index b3e4bf6d22cfc79a4d865698c9219584a0a65934..0341c3638bfeb6018326d1cbad86ca1363024ad9 100644 --- a/source/libs/catalog/src/ctgAsync.c +++ b/source/libs/catalog/src/ctgAsync.c @@ -770,7 +770,7 @@ _return: } ctgPutUpdateUserToQueue(pCtg, pOut, false); - pTask->msgCtx.out = NULL; + taosMemoryFreeClear(pTask->msgCtx.out); ctgHandleTaskEnd(pTask, code); diff --git a/source/libs/catalog/src/ctgCache.c b/source/libs/catalog/src/ctgCache.c index 27cd41eed5a51e66bc823ec5d2434adee60a4227..3c7d1e2bce9f247392e5aab91e5d5e916ecbad1e 100644 --- a/source/libs/catalog/src/ctgCache.c +++ b/source/libs/catalog/src/ctgCache.c @@ -715,8 +715,6 @@ int32_t ctgPutUpdateUserToQueue(SCatalog* pCtg, SGetUserAuthRsp *pAuth, bool syn action.data = msg; CTG_ERR_JRET(ctgPushAction(pCtg, &action)); - - taosMemoryFree(pAuth); return TSDB_CODE_SUCCESS;