Merge pull request #27450 from taosdata/enh/TD-30988-3.0

enh: refactor return code
This commit is contained in:
Hongze Cheng 2024-08-26 14:18:14 +08:00 committed by GitHub
commit e7fc467c59
No known key found for this signature in database
GPG Key ID: B5690EEEBB952194
2 changed files with 8 additions and 3 deletions

View File

@ -3147,7 +3147,7 @@ int32_t mndValidateUserAuthInfo(SMnode *pMnode, SUserAuthVersion *pUsers, int32_
if (TSDB_CODE_MND_USER_NOT_EXIST == code) {
SGetUserAuthRsp rsp = {.dropped = 1};
(void)memcpy(rsp.user, pUsers[i].user, TSDB_USER_LEN);
(void)taosArrayPush(batchRsp.pArray, &rsp);
TSDB_CHECK_NULL(taosArrayPush(batchRsp.pArray, &rsp), code, lino, _OVER, TSDB_CODE_OUT_OF_MEMORY);
}
mError("user:%s, failed to auth user since %s", pUsers[i].user, tstrerror(code));
code = 0;
@ -3168,7 +3168,12 @@ int32_t mndValidateUserAuthInfo(SMnode *pMnode, SUserAuthVersion *pUsers, int32_
TAOS_CHECK_GOTO(code, &lino, _OVER);
}
(void)taosArrayPush(batchRsp.pArray, &rsp);
if (!(taosArrayPush(batchRsp.pArray, &rsp))) {
code = TSDB_CODE_OUT_OF_MEMORY;
mndReleaseUser(pMnode, pUser);
tFreeSGetUserAuthRsp(&rsp);
TAOS_CHECK_GOTO(code, &lino, _OVER);
}
mndReleaseUser(pMnode, pUser);
}

View File

@ -213,7 +213,7 @@ static int32_t tdInitSmaStat(SSmaStat **pSmaStat, int8_t smaType, const SSma *pS
TAOS_CHECK_GOTO(code, &lino, _exit);
}
SSDataBlock datablock = {.info.type = STREAM_CHECKPOINT};
(void)taosArrayPush(pRSmaStat->blocks, &datablock);
TSDB_CHECK_NULL(taosArrayPush(pRSmaStat->blocks, &datablock), code, lino, _exit, TSDB_CODE_OUT_OF_MEMORY);
// init smaMgmt
TAOS_CHECK_GOTO(smaInit(), &lino, _exit);