diff --git a/src/cm_agent/client_adpts/libpq/cma_datanode_utils.cpp b/src/cm_agent/client_adpts/libpq/cma_datanode_utils.cpp index 25f2a2d3063aab27fc1c1f41a011b085ba4845ee..4c8f64250bfe59bc5b136785c32a7c5a35b50520 100644 --- a/src/cm_agent/client_adpts/libpq/cma_datanode_utils.cpp +++ b/src/cm_agent/client_adpts/libpq/cma_datanode_utils.cpp @@ -626,8 +626,8 @@ static void GetLpInfoByStr(char *channel, DnLocalPeer *lpInfo, uint32 instId) { char localIpStr[CM_IP_LENGTH]; char peerIpStr[CM_IP_LENGTH]; - char *peerStr = NULL; - char *localStr = strtok_r(channel, "<--", &peerStr); + char *remain = NULL; + char *localStr = strtok_r(channel, "<--", &remain); errno_t rc; if (localStr == NULL) { write_runlog(ERROR, "[GetLpInfoByStr] line: %d, instance ID is %u, channel is %s.\n", @@ -644,6 +644,7 @@ static void GetLpInfoByStr(char *channel, DnLocalPeer *lpInfo, uint32 instId) return; } + char *peerStr = strtok_r(remain, "<--", &remain); // Parse peer IP and port if (ParseIpAndPort(peerStr, peerIpStr, &lpInfo->peerPort) == 0) { rc = strcpy_s(lpInfo->peerIp, CM_IP_LENGTH, peerIpStr);