提交 96d4f0a7 编写于 作者: dengyihao's avatar dengyihao

[TD-11316]<fix> fix mem leak when taos_connect failed

上级 ab08e5cf
......@@ -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) {
......
......@@ -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) {
......
Markdown is supported
0% .
You are about to add 0 people to the discussion. Proceed with caution.
先完成此消息的编辑!
想要评论请 注册