From a32c2d3006f840244f3fff063b6a220d38a7392b Mon Sep 17 00:00:00 2001 From: zhihaop Date: Mon, 26 Sep 2022 15:34:07 +0800 Subject: [PATCH] fix(query): resources leaks in qExecutor.c --- src/query/src/qExecutor.c | 16 ++++++++++------ 1 file changed, 10 insertions(+), 6 deletions(-) diff --git a/src/query/src/qExecutor.c b/src/query/src/qExecutor.c index c6ef49535f..dc2678e8c9 100644 --- a/src/query/src/qExecutor.c +++ b/src/query/src/qExecutor.c @@ -6330,6 +6330,7 @@ SOperatorInfo* createOrderOperatorInfo(SQueryRuntimeEnv* pRuntimeEnv, SOperatorI pDataBlock->pDataBlock = taosArrayInit(numOfOutput, sizeof(SColumnInfoData)); if (pDataBlock->pDataBlock == NULL) { + free(pDataBlock); goto _clean; } @@ -8521,15 +8522,18 @@ SOperatorInfo* createSLimitOperatorInfo(SQueryRuntimeEnv* pRuntimeEnv, SOperator SColIndex* idx = taosArrayGet(pInfo->orderColumnList, i); offset += pExpr[idx->colIndex].base.resBytes; } - - pInfo->pRes = createOutputBuf(pExpr, numOfOutput, pRuntimeEnv->resultInfo.capacity); - + SOperatorInfo* pOperator = calloc(1, sizeof(SOperatorInfo)); - - if (pInfo->pRes == NULL || pOperator == NULL) { + if (pOperator == NULL) { goto _clean; } - + + pInfo->pRes = createOutputBuf(pExpr, numOfOutput, pRuntimeEnv->resultInfo.capacity); + if (pInfo->pRes == NULL) { + tfree(pOperator); + goto _clean; + } + pOperator->name = "SLimitOperator"; pOperator->operatorType = OP_SLimit; pOperator->blockingOptr = false; -- GitLab