提交 696d294f 编写于 作者: K kailixu

chore: code optimization

上级 c0148ed5
......@@ -523,7 +523,12 @@ static int32_t hbGetUserBasicInfo(SClientHbKey *connKey, SClientHbReq *req) {
return TSDB_CODE_APP_ERROR;
}
int32_t code = 0;
int32_t code = 0;
if (!pTscObj->passInfo.fp) {
goto _return;
}
SUserPassVersion *user = taosMemoryMalloc(sizeof(SUserPassVersion));
if (!user) {
code = TSDB_CODE_OUT_OF_MEMORY;
......
......@@ -121,13 +121,15 @@ TAOS *taos_connect(const char *ip, const char *user, const char *pass, const cha
int taos_set_notify_cb(TAOS *taos, __taos_notify_fn_t *fp, void *param, int type) {
if (taos == NULL) {
return TSDB_CODE_INVALID_PARA;
terrno = TSDB_CODE_INVALID_PARA;
return terrno;
}
STscObj *pObj = acquireTscObj(*(int64_t *)taos);
if (NULL == pObj) {
terrno = TSDB_CODE_TSC_DISCONNECTED;
tscError("invalid parameter for %s", __func__);
return TSDB_CODE_TSC_DISCONNECTED;
return terrno;
}
switch (type) {
......@@ -136,8 +138,11 @@ int taos_set_notify_cb(TAOS *taos, __taos_notify_fn_t *fp, void *param, int type
pObj->passInfo.param = param;
break;
}
default:
break;
default: {
terrno = TSDB_CODE_INVALID_PARA;
releaseTscObj(*(int64_t *)taos);
return terrno;
}
}
releaseTscObj(*(int64_t *)taos);
......
......@@ -1455,6 +1455,7 @@ int32_t mndValidateUserPassInfo(SMnode *pMnode, SUserPassVersion *pUsers, int32_
if (!batchRsp.pArray && !(batchRsp.pArray = taosArrayInit(numOfUses, sizeof(SGetUserPassRsp)))) {
code = TSDB_CODE_OUT_OF_MEMORY;
mndReleaseUser(pMnode, pUser);
goto _OVER;
}
......
Markdown is supported
0% .
You are about to add 0 people to the discussion. Proceed with caution.
先完成此消息的编辑!
想要评论请 注册