fix mem free issue

This commit is contained in:
dapan1121 2022-05-25 22:05:29 +08:00
parent 55ec2aa008
commit 8d56f7e1ec
3 changed files with 8 additions and 13 deletions

View File

@ -327,31 +327,28 @@ int32_t ctgChkAuth(SCatalog* pCtg, void *pTrans, const SEpSet* pMgmtEps, const c
return TSDB_CODE_SUCCESS; return TSDB_CODE_SUCCESS;
} }
SGetUserAuthRsp* authRsp = taosMemoryCalloc(1, sizeof(SGetUserAuthRsp)); SGetUserAuthRsp authRsp = {0};
if (NULL == authRsp) { CTG_ERR_RET(ctgGetUserDbAuthFromMnode(CTG_PARAMS_LIST(), user, &authRsp, NULL));
CTG_ERR_RET(TSDB_CODE_OUT_OF_MEMORY);
}
CTG_ERR_RET(ctgGetUserDbAuthFromMnode(CTG_PARAMS_LIST(), user, authRsp, NULL));
if (authRsp->superAuth) { if (authRsp.superAuth) {
*pass = true; *pass = true;
goto _return; goto _return;
} }
if (authRsp->createdDbs && taosHashGet(authRsp->createdDbs, dbFName, strlen(dbFName))) { if (authRsp.createdDbs && taosHashGet(authRsp.createdDbs, dbFName, strlen(dbFName))) {
*pass = true; *pass = true;
goto _return; 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; *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; *pass = true;
} }
_return: _return:
ctgPutUpdateUserToQueue(pCtg, authRsp, false); ctgPutUpdateUserToQueue(pCtg, &authRsp, false);
return TSDB_CODE_SUCCESS; return TSDB_CODE_SUCCESS;
} }

View File

@ -770,7 +770,7 @@ _return:
} }
ctgPutUpdateUserToQueue(pCtg, pOut, false); ctgPutUpdateUserToQueue(pCtg, pOut, false);
pTask->msgCtx.out = NULL; taosMemoryFreeClear(pTask->msgCtx.out);
ctgHandleTaskEnd(pTask, code); ctgHandleTaskEnd(pTask, code);

View File

@ -715,8 +715,6 @@ int32_t ctgPutUpdateUserToQueue(SCatalog* pCtg, SGetUserAuthRsp *pAuth, bool syn
action.data = msg; action.data = msg;
CTG_ERR_JRET(ctgPushAction(pCtg, &action)); CTG_ERR_JRET(ctgPushAction(pCtg, &action));
taosMemoryFree(pAuth);
return TSDB_CODE_SUCCESS; return TSDB_CODE_SUCCESS;