From 3843fa6de8572c24c5927c96b91ad87e54c273dd Mon Sep 17 00:00:00 2001 From: yihaoDeng Date: Tue, 26 Nov 2024 19:45:00 +0800 Subject: [PATCH] fix invalid free --- source/libs/transport/src/transCli.c | 7 +++---- source/libs/transport/src/transSvr.c | 3 +++ 2 files changed, 6 insertions(+), 4 deletions(-) diff --git a/source/libs/transport/src/transCli.c b/source/libs/transport/src/transCli.c index 2e6cb0b909..c62b8d21c9 100644 --- a/source/libs/transport/src/transCli.c +++ b/source/libs/transport/src/transCli.c @@ -2498,10 +2498,6 @@ static int32_t createThrdObj(void* trans, SCliThrd** ppThrd) { _end: if (pThrd) { TAOS_UNUSED(taosThreadMutexDestroy(&pThrd->msgMtx)); - - TAOS_UNUSED(uv_loop_close(pThrd->loop)); - taosMemoryFree(pThrd->loop); - TAOS_UNUSED((taosThreadMutexDestroy(&pThrd->msgMtx))); transAsyncPoolDestroy(pThrd->asyncPool); for (int i = 0; i < taosArrayGetSize(pThrd->timerList); i++) { uv_timer_t* timer = taosArrayGetP(pThrd->timerList, i); @@ -2511,6 +2507,9 @@ _end: taosArrayDestroy(pThrd->timerList); TAOS_UNUSED(destroyConnPool(pThrd)); + TAOS_UNUSED(uv_loop_close(pThrd->loop)); + taosMemoryFree(pThrd->loop); + transDQDestroy(pThrd->delayQueue, NULL); transDQDestroy(pThrd->timeoutQueue, NULL); transDQDestroy(pThrd->waitConnQueue, NULL); diff --git a/source/libs/transport/src/transSvr.c b/source/libs/transport/src/transSvr.c index e6ddd588e1..b1a5463309 100644 --- a/source/libs/transport/src/transSvr.c +++ b/source/libs/transport/src/transSvr.c @@ -1379,6 +1379,9 @@ _end: pConn = NULL; } tError("%s failed to create conn since %s", transLabel(pInst), tstrerror(code)); + return NULL; +_end2: + return NULL; }