From 9e527632979bdb7bee7a1819993652d696a00736 Mon Sep 17 00:00:00 2001 From: Jing Sima Date: Thu, 29 Aug 2024 14:36:53 +0800 Subject: [PATCH] fix:[TD-31700] fix memory leak when error occurs in sclExecOperator. --- source/libs/scalar/src/scalar.c | 5 ++--- 1 file changed, 2 insertions(+), 3 deletions(-) diff --git a/source/libs/scalar/src/scalar.c b/source/libs/scalar/src/scalar.c index cff73067b1..0fc4a046f5 100644 --- a/source/libs/scalar/src/scalar.c +++ b/source/libs/scalar/src/scalar.c @@ -879,7 +879,7 @@ int32_t sclExecOperator(SOperatorNode *node, SScalarCtx *ctx, SScalarParam *outp SScalarParam *params = NULL; int32_t rowNum = 0; int32_t code = 0; - int32_t paramNum = 0; + int32_t paramNum = scalarGetOperatorParamNum(node->opType); // json not support in in operator if (nodeType(node->pLeft) == QUERY_NODE_VALUE) { @@ -890,7 +890,7 @@ int32_t sclExecOperator(SOperatorNode *node, SScalarCtx *ctx, SScalarParam *outp } } - SCL_ERR_RET(sclInitOperatorParams(¶ms, node, ctx, &rowNum)); + SCL_ERR_JRET(sclInitOperatorParams(¶ms, node, ctx, &rowNum)); if (output->columnData == NULL) { code = sclCreateColumnInfoData(&node->node.resType, rowNum, output); if (code != TSDB_CODE_SUCCESS) { @@ -900,7 +900,6 @@ int32_t sclExecOperator(SOperatorNode *node, SScalarCtx *ctx, SScalarParam *outp _bin_scalar_fn_t OperatorFn = getBinScalarOperatorFn(node->opType); - paramNum = scalarGetOperatorParamNum(node->opType); SScalarParam *pLeft = ¶ms[0]; SScalarParam *pRight = paramNum > 1 ? ¶ms[1] : NULL;