提交 3e5aec67 编写于 作者: H Haojun Liao

[td-225]fix memory leak.

上级 7bc4a2ef
......@@ -2155,7 +2155,7 @@ int tscProcessShowRsp(SSqlObj *pSql) {
uint64_t uid = pTableMetaInfo->pTableMeta->id.uid;
for (int16_t i = 0; i < pMetaMsg->numOfColumns; ++i, ++pSchema) {
index.columnIndex = i;
tscColumnListInsert(pQueryInfo->colList, i, uid, &pSchema[i]);
tscColumnListInsert(pQueryInfo->colList, i, uid, pSchema);
TAOS_FIELD f = tscCreateField(pSchema->type, pSchema->name, pSchema->bytes);
SInternalField* pInfo = tscFieldInfoAppend(pFieldInfo, &f);
......
......@@ -106,11 +106,6 @@ typedef struct STableNamePair {
SStrToken aliasName;
} STableNamePair;
//typedef struct SSubclauseInfo { // "UNION" multiple select sub-clause
// SSqlNode **pClause;
// int32_t numOfClause;
//} SSubclauseInfo;
typedef struct SRelationInfo {
int32_t type; // nested query|table name list
SArray *list; // SArray<STableNamePair>|SArray<SSqlNode*>
......@@ -253,7 +248,7 @@ SArray *tVariantListAppendToken(SArray *pList, SStrToken *pAliasToken, uint8_t s
SRelationInfo *setTableNameList(SRelationInfo* pFromInfo, SStrToken *pName, SStrToken* pAlias);
SRelationInfo *setSubquery(SRelationInfo* pFromInfo, SArray* pSqlNode);
void *destroyFromInfo(SRelationInfo* pFromInfo);
void *destroyRelationInfo(SRelationInfo* pFromInfo);
// sql expr leaf node
tSqlExpr *tSqlExprCreateIdValue(SStrToken *pToken, int32_t optrType);
......
......@@ -506,10 +506,12 @@ distinct(X) ::= . { X.n = 0;}
// A complete FROM clause.
%type from {SRelationInfo*}
%destructor from {destroyRelationInfo($$);}
from(A) ::= FROM tablelist(X). {A = X;}
from(A) ::= FROM LP union(Y) RP. {A = setSubquery(NULL, Y);}
%type tablelist {SRelationInfo*}
%destructor tablelist {destroyRelationInfo($$);}
tablelist(A) ::= ids(X) cpxName(Y). {
X.n += Y.n;
A = setTableNameList(NULL, &X, NULL);
......
......@@ -552,7 +552,7 @@ SRelationInfo* setSubquery(SRelationInfo* pRelationInfo, SArray* pList) {
return pRelationInfo;
}
void* destroyFromInfo(SRelationInfo* pRelationInfo) {
void* destroyRelationInfo(SRelationInfo* pRelationInfo) {
if (pRelationInfo == NULL) {
return NULL;
}
......@@ -799,7 +799,7 @@ void destroySqlNode(SSqlNode *pSqlNode) {
taosArrayDestroyEx(pSqlNode->pGroupby, freeVariant);
pSqlNode->pGroupby = NULL;
pSqlNode->from = destroyFromInfo(pSqlNode->from);
pSqlNode->from = destroyRelationInfo(pSqlNode->from);
taosArrayDestroyEx(pSqlNode->fillType, freeVariant);
pSqlNode->fillType = NULL;
......
......@@ -1433,6 +1433,12 @@ destroySqlNode((yypminor->yy116));
case 261: /* exprlist */
{
tSqlExprListDestroy((yypminor->yy159));
}
break;
case 238: /* from */
case 254: /* tablelist */
{
destroyRelationInfo((yypminor->yy236));
}
break;
case 239: /* where_opt */
......
Markdown is supported
0% .
You are about to add 0 people to the discussion. Proceed with caution.
先完成此消息的编辑!
想要评论请 注册