From 099beff1cc7a0b4b6f12dddd90559cf91406d3a1 Mon Sep 17 00:00:00 2001 From: dapan1121 Date: Thu, 22 Aug 2024 17:07:00 +0800 Subject: [PATCH] fix: operator param free issue --- source/libs/executor/src/dynqueryctrloperator.c | 17 ++++++----------- 1 file changed, 6 insertions(+), 11 deletions(-) diff --git a/source/libs/executor/src/dynqueryctrloperator.c b/source/libs/executor/src/dynqueryctrloperator.c index e816d64d5b..6268fa0268 100644 --- a/source/libs/executor/src/dynqueryctrloperator.c +++ b/source/libs/executor/src/dynqueryctrloperator.c @@ -310,39 +310,34 @@ static int32_t buildBatchExchangeOperatorParam(SOperatorParam** ppRes, int32_t d } -static int32_t buildMergeJoinOperatorParam(SOperatorParam** ppRes, bool initParam, SOperatorParam* pChild0, SOperatorParam* pChild1) { +static int32_t buildMergeJoinOperatorParam(SOperatorParam** ppRes, bool initParam, SOperatorParam** ppChild0, SOperatorParam** ppChild1) { int32_t code = TSDB_CODE_SUCCESS; *ppRes = taosMemoryMalloc(sizeof(SOperatorParam)); if (NULL == *ppRes) { code = terrno; - freeOperatorParam(pChild0, OP_GET_PARAM); - freeOperatorParam(pChild1, OP_GET_PARAM); return code; } (*ppRes)->pChildren = taosArrayInit(2, POINTER_BYTES); if (NULL == (*ppRes)->pChildren) { code = terrno; - freeOperatorParam(pChild0, OP_GET_PARAM); - freeOperatorParam(pChild1, OP_GET_PARAM); freeOperatorParam(*ppRes, OP_GET_PARAM); *ppRes = NULL; return code; } - if (NULL == taosArrayPush((*ppRes)->pChildren, &pChild0)) { + if (NULL == taosArrayPush((*ppRes)->pChildren, ppChild0)) { code = terrno; - freeOperatorParam(pChild0, OP_GET_PARAM); - freeOperatorParam(pChild1, OP_GET_PARAM); freeOperatorParam(*ppRes, OP_GET_PARAM); *ppRes = NULL; return code; } - if (NULL == taosArrayPush((*ppRes)->pChildren, &pChild1)) { + *ppChild0 = NULL; + if (NULL == taosArrayPush((*ppRes)->pChildren, ppChild1)) { code = terrno; - freeOperatorParam(pChild1, OP_GET_PARAM); freeOperatorParam(*ppRes, OP_GET_PARAM); *ppRes = NULL; return code; } + *ppChild1 = NULL; SSortMergeJoinOperatorParam* pJoin = taosMemoryMalloc(sizeof(SSortMergeJoinOperatorParam)); if (NULL == pJoin) { @@ -493,7 +488,7 @@ static int32_t buildSeqStbJoinOperatorParam(SDynQueryCtrlOperatorInfo* pInfo, SS pSrcParam1 = NULL; } if (TSDB_CODE_SUCCESS == code) { - code = buildMergeJoinOperatorParam(ppParam, initParam, pGcParam0, pGcParam1); + code = buildMergeJoinOperatorParam(ppParam, initParam, &pGcParam0, &pGcParam1); } if (TSDB_CODE_SUCCESS != code) { if (pSrcParam0) {