提交 f944634f 编写于 作者: S shenglian zhou

fix error that allocate for pchildren array of function expr node

上级 2bb1697d
...@@ -147,6 +147,7 @@ static void doExprTreeDestroy(tExprNode **pExpr, void (*fp)(void *)) { ...@@ -147,6 +147,7 @@ static void doExprTreeDestroy(tExprNode **pExpr, void (*fp)(void *)) {
for (int i = 0; i < (*pExpr)->_func.numChildren; ++i) { for (int i = 0; i < (*pExpr)->_func.numChildren; ++i) {
doExprTreeDestroy((*pExpr)->_func.pChildren + i, fp); doExprTreeDestroy((*pExpr)->_func.pChildren + i, fp);
} }
free((*pExpr)->_func.pChildren);
} }
free(*pExpr); free(*pExpr);
...@@ -732,6 +733,7 @@ tExprNode* exprdup(tExprNode* pNode) { ...@@ -732,6 +733,7 @@ tExprNode* exprdup(tExprNode* pNode) {
} else if (pNode->nodeType == TSQL_NODE_FUNC) { } else if (pNode->nodeType == TSQL_NODE_FUNC) {
pCloned->_func.functionId = pNode->_func.functionId; pCloned->_func.functionId = pNode->_func.functionId;
pCloned->_func.numChildren = pNode->_func.numChildren; pCloned->_func.numChildren = pNode->_func.numChildren;
pCloned->_func.pChildren = calloc(pNode->_func.numChildren, sizeof(tExprNode*));
for (int i = 0; i < pNode->_func.numChildren; ++i) { for (int i = 0; i < pNode->_func.numChildren; ++i) {
pCloned->_func.pChildren[i] = exprdup(pNode->_func.pChildren[i]); pCloned->_func.pChildren[i] = exprdup(pNode->_func.pChildren[i]);
} }
......
Markdown is supported
0% .
You are about to add 0 people to the discussion. Proceed with caution.
先完成此消息的编辑!
想要评论请 注册