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

[td-225]fix memory leak.

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