[td-1764] fix memory leak.

This commit is contained in:
Haojun Liao 2020-10-21 10:51:46 +08:00
parent 58e1f85249
commit 6b985a6e86
2 changed files with 5 additions and 2 deletions

View File

@ -510,7 +510,8 @@ void tscDestroyLocalReducer(SSqlObj *pSql) {
taosTFree(pLocalReducer->pResultBuf); taosTFree(pLocalReducer->pResultBuf);
if (pLocalReducer->pResInfo != NULL) { if (pLocalReducer->pResInfo != NULL) {
for (int32_t i = 0; i < pQueryInfo->fieldsInfo.numOfOutput; ++i) { size_t num = tscSqlExprNumOfExprs(pQueryInfo);
for (int32_t i = 0; i < num; ++i) {
taosTFree(pLocalReducer->pResInfo[i].interResultBuf); taosTFree(pLocalReducer->pResInfo[i].interResultBuf);
} }

View File

@ -972,6 +972,8 @@ void tscFieldInfoClear(SFieldInfo* pFieldInfo) {
} }
taosArrayDestroy(pFieldInfo->internalField); taosArrayDestroy(pFieldInfo->internalField);
taosTFree(pFieldInfo->final);
memset(pFieldInfo, 0, sizeof(SFieldInfo)); memset(pFieldInfo, 0, sizeof(SFieldInfo));
} }
@ -1834,7 +1836,7 @@ static void doSetSqlExprAndResultFieldInfo(SQueryInfo* pQueryInfo, SQueryInfo* p
return; return;
} }
// set the field info in pNewQueryInfo object // set the field info in pNewQueryInfo object according to sqlExpr information
size_t numOfExprs = tscSqlExprNumOfExprs(pNewQueryInfo); size_t numOfExprs = tscSqlExprNumOfExprs(pNewQueryInfo);
for (int32_t i = 0; i < numOfExprs; ++i) { for (int32_t i = 0; i < numOfExprs; ++i) {
SSqlExpr* pExpr = tscSqlExprGet(pNewQueryInfo, i); SSqlExpr* pExpr = tscSqlExprGet(pNewQueryInfo, i);