From f944634f8c89091274a2abe4f4a7ddf07406acd8 Mon Sep 17 00:00:00 2001 From: shenglian zhou Date: Tue, 2 Nov 2021 09:48:59 +0800 Subject: [PATCH] fix error that allocate for pchildren array of function expr node --- src/common/src/texpr.c | 2 ++ 1 file changed, 2 insertions(+) diff --git a/src/common/src/texpr.c b/src/common/src/texpr.c index 59ea613eab..f697e47074 100644 --- a/src/common/src/texpr.c +++ b/src/common/src/texpr.c @@ -147,6 +147,7 @@ static void doExprTreeDestroy(tExprNode **pExpr, void (*fp)(void *)) { for (int i = 0; i < (*pExpr)->_func.numChildren; ++i) { doExprTreeDestroy((*pExpr)->_func.pChildren + i, fp); } + free((*pExpr)->_func.pChildren); } free(*pExpr); @@ -732,6 +733,7 @@ tExprNode* exprdup(tExprNode* pNode) { } else if (pNode->nodeType == TSQL_NODE_FUNC) { pCloned->_func.functionId = pNode->_func.functionId; pCloned->_func.numChildren = pNode->_func.numChildren; + pCloned->_func.pChildren = calloc(pNode->_func.numChildren, sizeof(tExprNode*)); for (int i = 0; i < pNode->_func.numChildren; ++i) { pCloned->_func.pChildren[i] = exprdup(pNode->_func.pChildren[i]); } -- GitLab