From f867e8ea9165c20f0f09c56765e7f236401db6ad Mon Sep 17 00:00:00 2001 From: Haojun Liao Date: Sat, 7 May 2022 17:23:05 +0800 Subject: [PATCH] fix(query): eliminate memory leak. --- source/libs/executor/inc/executorimpl.h | 1 + source/libs/executor/src/executorMain.c | 15 --------------- source/libs/executor/src/executorimpl.c | 2 +- 3 files changed, 2 insertions(+), 16 deletions(-) diff --git a/source/libs/executor/inc/executorimpl.h b/source/libs/executor/inc/executorimpl.h index 9eed76a0fe..3ed65f4a05 100644 --- a/source/libs/executor/inc/executorimpl.h +++ b/source/libs/executor/inc/executorimpl.h @@ -225,6 +225,7 @@ typedef struct SExecTaskInfo { char* sql; // query sql string jmp_buf env; // jump to this position when error happens. EOPTR_EXEC_MODEL execModel; // operator execution model [batch model|stream model] + struct SSubplan *plan; struct SOperatorInfo* pRoot; } SExecTaskInfo; diff --git a/source/libs/executor/src/executorMain.c b/source/libs/executor/src/executorMain.c index 7705744694..ba77950912 100644 --- a/source/libs/executor/src/executorMain.c +++ b/source/libs/executor/src/executorMain.c @@ -36,21 +36,6 @@ typedef struct STaskMgmt { bool closed; } STaskMgmt; -static void taskMgmtKillTaskFn(void* handle, void* param1) { - void** fp = (void**)handle; - qKillTask(*fp); -} - -static void freeqinfoFn(void *qhandle) { - void** handle = qhandle; - if (handle == NULL || *handle == NULL) { - return; - } - - qKillTask(*handle); - qDestroyTask(*handle); -} - int32_t qCreateExecTask(SReadHandle* readHandle, int32_t vgId, uint64_t taskId, SSubplan* pSubplan, qTaskInfo_t* pTaskInfo, DataSinkHandle* handle, EOPTR_EXEC_MODEL model) { assert(readHandle != NULL && pSubplan != NULL); diff --git a/source/libs/executor/src/executorimpl.c b/source/libs/executor/src/executorimpl.c index 34339d3a7f..c0ea54ce4a 100644 --- a/source/libs/executor/src/executorimpl.c +++ b/source/libs/executor/src/executorimpl.c @@ -5209,6 +5209,7 @@ int32_t createExecTaskInfoImpl(SSubplan* pPlan, SExecTaskInfo** pTaskInfo, SRead goto _complete; } + (*pTaskInfo)->plan = pPlan; return code; _complete: @@ -5311,7 +5312,6 @@ void doDestroyTask(SExecTaskInfo* pTaskInfo) { // taosArrayDestroy(pTaskInfo->summary.queryProfEvents); // taosHashCleanup(pTaskInfo->summary.operatorProfResults); - destroyOperatorInfo(pTaskInfo->pRoot); taosMemoryFreeClear(pTaskInfo->sql); taosMemoryFreeClear(pTaskInfo->id.str); taosMemoryFreeClear(pTaskInfo);