From 9278ed2ab5b608cd8b497d7f24517ee91a2c403e Mon Sep 17 00:00:00 2001 From: yihaoDeng Date: Tue, 29 Nov 2022 21:59:49 +0800 Subject: [PATCH] fix mem leak --- source/libs/scheduler/inc/schInt.h | 8 ++++---- source/libs/scheduler/src/schTask.c | 7 ++++++- 2 files changed, 10 insertions(+), 5 deletions(-) diff --git a/source/libs/scheduler/inc/schInt.h b/source/libs/scheduler/inc/schInt.h index 83b58a77d2..dfc48e7d9f 100644 --- a/source/libs/scheduler/inc/schInt.h +++ b/source/libs/scheduler/inc/schInt.h @@ -146,7 +146,7 @@ typedef struct SSchedulerMgmt { bool exit; int32_t jobRef; int32_t jobNum; - SSchStat stat; + SSchStat stat; void *timer; SRWLatch hbLock; SHashObj *hbConnections; @@ -214,9 +214,9 @@ typedef struct SSchRedirectCtx { } SSchRedirectCtx; typedef struct SSchTimerParam { - int64_t rId; - uint64_t queryId; - uint64_t taskId; + int64_t rId; + uint64_t queryId; + uint64_t taskId; } SSchTimerParam; typedef struct SSchTask { diff --git a/source/libs/scheduler/src/schTask.c b/source/libs/scheduler/src/schTask.c index ed052be784..9a7f3332b3 100644 --- a/source/libs/scheduler/src/schTask.c +++ b/source/libs/scheduler/src/schTask.c @@ -1152,7 +1152,12 @@ void schHandleTimerEvent(void *param, void *tmrId) { SSchJob *pJob = NULL; int32_t code = 0; - if (schProcessOnCbBegin(&pJob, &pTask, pTimerParam->queryId, pTimerParam->rId, pTimerParam->taskId)) { + int64_t rId = pTimerParam->rId; + uint64_t queryId = pTimerParam->queryId; + uint64_t taskId = pTimerParam->taskId; + taosMemoryFree(pTimerParam); + + if (schProcessOnCbBegin(&pJob, &pTask, queryId, rId, taskId)) { return; }