diff --git a/src/client/src/tscSql.c b/src/client/src/tscSql.c index 89da3c5640c6523d4d2a816b8ae0293310c5830a..380ce651332135c4fc9fab112e8ac66a23b722c8 100644 --- a/src/client/src/tscSql.c +++ b/src/client/src/tscSql.c @@ -195,6 +195,9 @@ TAOS *taos_connect_internal(const char *ip, const char *user, const char *pass, tsem_wait(&pSql->rspSem); pSql->pTscObj->pClusterInfo = (SClusterInfo *)tscAcquireClusterInfo(pSql->pTscObj->clusterId); + if (pSql->pTscObj->pClusterInfo == NULL) { + assert(pSql->res.code != TSDB_CODE_SUCCESS); + } if (pSql->res.code != TSDB_CODE_SUCCESS) { terrno = pSql->res.code; if (terrno ==TSDB_CODE_RPC_FQDN_ERROR) { diff --git a/src/client/src/tscSystem.c b/src/client/src/tscSystem.c index f6614fdb79f18b70cadc2351edc8e402e95bf41e..bc8d0db4858bff7f38fdfb2b463d583bcac06fc2 100644 --- a/src/client/src/tscSystem.c +++ b/src/client/src/tscSystem.c @@ -133,8 +133,11 @@ void tscClusterInfoDestroy(SClusterInfo *pObj) { void *tscAcquireClusterInfo(const char *clusterId) { pthread_mutex_lock(&clusterMutex); - size_t len = strlen(clusterId); + if (len == 0) { + pthread_mutex_unlock(&clusterMutex); + return NULL; + } SClusterInfo *pObj = NULL; SClusterInfo **ppObj = taosHashGet(tscClusterMap, clusterId, len); if (ppObj == NULL || *ppObj == NULL) {