From 7efdc9e27a32e212bef13efa201c5d170c044f42 Mon Sep 17 00:00:00 2001 From: Haojun Liao Date: Wed, 11 Jan 2023 18:00:36 +0800 Subject: [PATCH] fix(query): fix memory leak. --- .../libs/executor/src/eventwindowoperator.c | 19 +++++++++++++++++++ tests/script/tsim/query/event.sim | 4 ++-- 2 files changed, 21 insertions(+), 2 deletions(-) diff --git a/source/libs/executor/src/eventwindowoperator.c b/source/libs/executor/src/eventwindowoperator.c index 215636a567..0dbc05ceef 100644 --- a/source/libs/executor/src/eventwindowoperator.c +++ b/source/libs/executor/src/eventwindowoperator.c @@ -157,6 +157,20 @@ void destroyEWindowOperatorInfo(void* param) { return; } + if (pInfo->pRow != NULL) { + taosMemoryFree(pInfo->pRow); + } + + if (pInfo->pStartCondInfo != NULL) { + filterFreeInfo(pInfo->pStartCondInfo); + pInfo->pStartCondInfo = NULL; + } + + if (pInfo->pEndCondInfo != NULL) { + filterFreeInfo(pInfo->pEndCondInfo); + pInfo->pEndCondInfo = NULL; + } + cleanupBasicInfo(&pInfo->binfo); colDataDestroy(&pInfo->twAggSup.timeWindowData); @@ -315,4 +329,9 @@ void eventWindowAggImpl(SOperatorInfo* pOperator, SEventWindowOperatorInfo* pInf } } } + + colDataDestroy(ps); + taosMemoryFree(ps); + colDataDestroy(pe); + taosMemoryFree(pe); } diff --git a/tests/script/tsim/query/event.sim b/tests/script/tsim/query/event.sim index c72b7ba125..adc94a34de 100644 --- a/tests/script/tsim/query/event.sim +++ b/tests/script/tsim/query/event.sim @@ -36,7 +36,7 @@ endi # child table: single row window print ====> select count(*) from tba1 event_window start with f1 = 0 end with f3 = false; sql select count(*) from tba1 event_window start with f1 = 0 end with f3 = false -if $rows != 1 then +if $rows != 2 then return -1 endi if $data00 != 1 then @@ -62,7 +62,7 @@ endi if $data00 != 2 then return -1 endi -if $data00 != 4 then +if $data10 != 4 then return -1 endi -- GitLab