fix: invalid read

This commit is contained in:
yihaoDeng 2023-02-15 21:16:08 +08:00
parent 9c050c0ea6
commit 015dd658e6
1 changed files with 3 additions and 4 deletions

View File

@ -736,6 +736,9 @@ static void cliDestroy(uv_handle_t* handle) {
conn->timer->data = NULL;
conn->timer = NULL;
}
int32_t* oVal = taosHashGet(pThrd->connLimitCache, conn->ip, strlen(conn->ip));
int32_t nVal = oVal == NULL ? 0 : (*oVal) - 1;
taosHashPut(pThrd->connLimitCache, conn->ip, strlen(conn->ip), &nVal, sizeof(nVal));
atomic_sub_fetch_32(&pThrd->connCount, 1);
@ -750,10 +753,6 @@ static void cliDestroy(uv_handle_t* handle) {
transReqQueueClear(&conn->wreqQueue);
transDestroyBuffer(&conn->readBuf);
int32_t* oVal = taosHashGet(pThrd->connLimitCache, conn->ip, strlen(conn->ip));
int32_t nVal = oVal == NULL ? 0 : (*oVal) - 1;
taosHashPut(pThrd->connLimitCache, conn->ip, strlen(conn->ip), &nVal, sizeof(nVal));
taosMemoryFree(conn);
}
static bool cliHandleNoResp(SCliConn* conn) {