From 792e16befce5563751c41d67465d728ead159dd0 Mon Sep 17 00:00:00 2001 From: yihaoDeng Date: Thu, 16 Feb 2023 10:36:49 +0800 Subject: [PATCH] fix invalid read --- source/libs/transport/src/transCli.c | 11 +++-------- 1 file changed, 3 insertions(+), 8 deletions(-) diff --git a/source/libs/transport/src/transCli.c b/source/libs/transport/src/transCli.c index e91fe337fc..415005a1e1 100644 --- a/source/libs/transport/src/transCli.c +++ b/source/libs/transport/src/transCli.c @@ -893,14 +893,9 @@ static void cliHandleFastFail(SCliConn* pConn, int status) { SCliMsg* pMsg = transQueueGet(&pConn->cliMsgs, 0); - // if (pMsg) { STraceId* trace = &pMsg->msg.info.traceId; tGError("%s msg %s failed to send, conn %p failed to connect to %s, reason: %s", CONN_GET_INST_LABEL(pConn), TMSG_INFO(pMsg->msg.msgType), pConn, pConn->ip, uv_strerror(status)); - //} else { - // tError("%s msg %s failed to send, conn %p failed to connect to %s, reason: %s", CONN_GET_INST_LABEL(pConn), - // TMSG_INFO(0), pConn, pConn->ip, uv_strerror(status)); - //} uv_timer_stop(pConn->timer); pConn->timer->data = NULL; @@ -1158,13 +1153,13 @@ void cliHandleReq(SCliMsg* pMsg, SCliThrd* pThrd) { transQueuePush(&conn->cliMsgs, pMsg); char key[TSDB_FQDN_LEN + 64] = {0}; - char* ip = EPSET_GET_INUSE_IP(&pCtx->epSet); + char* fqdn = EPSET_GET_INUSE_IP(&pCtx->epSet); uint16_t port = EPSET_GET_INUSE_PORT(&pCtx->epSet); - CONN_CONSTRUCT_HASH_KEY(key, ip, port); + CONN_CONSTRUCT_HASH_KEY(key, fqdn, port); conn->ip = strdup(key); - uint32_t ipaddr = cliGetIpFromFqdnCache(pThrd->fqdn2ipCache, EPSET_GET_INUSE_IP(&pCtx->epSet)); + uint32_t ipaddr = cliGetIpFromFqdnCache(pThrd->fqdn2ipCache, fqdn); if (ipaddr == 0xffffffff) { uv_timer_stop(conn->timer); conn->timer->data = NULL; -- GitLab