Merge pull request #28140 from taosdata/fix/TD-32352

fix invalid free
This commit is contained in:
Hongze Cheng 2024-09-27 08:55:03 +08:00 committed by GitHub
commit db4aa2a792
No known key found for this signature in database
GPG Key ID: B5690EEEBB952194
1 changed files with 8 additions and 0 deletions

View File

@ -493,6 +493,12 @@ void cliHandleResp(SCliConn* conn) {
}
if (CONN_NO_PERSIST_BY_APP(conn)) {
SExHandle* exh = transAcquireExHandle(transGetRefMgt(), refId);
if (exh != NULL) {
exh->handle = NULL;
}
TAOS_UNUSED(transReleaseExHandle(transGetRefMgt(), refId));
return addConnToPool(pThrd->pool, conn);
}
@ -1059,6 +1065,7 @@ static void cliDestroyConn(SCliConn* conn, bool clear) {
}
conn->list = NULL;
TAOS_UNUSED(transReleaseExHandle(transGetRefMgt(), conn->refId));
TAOS_UNUSED(transReleaseExHandle(transGetRefMgt(), conn->refId));
TAOS_UNUSED(transRemoveExHandle(transGetRefMgt(), conn->refId));
conn->refId = -1;
@ -1087,6 +1094,7 @@ static void cliDestroy(uv_handle_t* handle) {
TAOS_UNUSED(atomic_sub_fetch_32(&pThrd->connCount, 1));
if (conn->refId > 0) {
TAOS_UNUSED(transReleaseExHandle(transGetRefMgt(), conn->refId));
TAOS_UNUSED(transReleaseExHandle(transGetRefMgt(), conn->refId));
TAOS_UNUSED(transRemoveExHandle(transGetRefMgt(), conn->refId));
}