diff --git a/source/client/src/clientHb.c b/source/client/src/clientHb.c index dd40a18c88..04e45609e6 100644 --- a/source/client/src/clientHb.c +++ b/source/client/src/clientHb.c @@ -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; diff --git a/source/client/src/clientMain.c b/source/client/src/clientMain.c index b47e5bf53b..4de8c408c7 100644 --- a/source/client/src/clientMain.c +++ b/source/client/src/clientMain.c @@ -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); diff --git a/source/dnode/mnode/impl/src/mndUser.c b/source/dnode/mnode/impl/src/mndUser.c index 1c64024eac..f6e5895cda 100644 --- a/source/dnode/mnode/impl/src/mndUser.c +++ b/source/dnode/mnode/impl/src/mndUser.c @@ -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; }