From 5c6b5f0d0fd3b27312e65c38c4cd8e36ebcddf83 Mon Sep 17 00:00:00 2001 From: yihaoDeng Date: Wed, 15 Feb 2023 21:58:56 +0800 Subject: [PATCH] fix: invalid read --- source/libs/transport/src/transCli.c | 14 ++++++++++---- 1 file changed, 10 insertions(+), 4 deletions(-) diff --git a/source/libs/transport/src/transCli.c b/source/libs/transport/src/transCli.c index 22bcb93218..681644d3bf 100644 --- a/source/libs/transport/src/transCli.c +++ b/source/libs/transport/src/transCli.c @@ -891,11 +891,17 @@ static void cliHandleFastFail(SCliConn* pConn, int status) { SCliThrd* pThrd = pConn->hostThrd; STrans* pTransInst = pThrd->pTransInst; - SCliMsg* pMsg = transQueueGet(&pConn->cliMsgs, 0); - STraceId* trace = &pMsg->msg.info.traceId; + 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), + pMsg ? TMSG_INFO(pMsg->msg.msgType) : 0, 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), 0, + pConn, pConn->ip, uv_strerror(status)); + } - tGError("%s msg %s failed to send, conn %p failed to connect to %s, reason: %s", CONN_GET_INST_LABEL(pConn), - pMsg ? TMSG_INFO(pMsg->msg.msgType) : 0, pConn, pConn->ip, uv_strerror(status)); uv_timer_stop(pConn->timer); pConn->timer->data = NULL; taosArrayPush(pThrd->timerList, &pConn->timer);