fix mem leak

This commit is contained in:
wpan 2021-08-17 12:59:30 +08:00
parent f85b81e056
commit 176af30aec
3 changed files with 19 additions and 0 deletions

View File

@ -52,6 +52,8 @@ int tsInsertInitialCheck(SSqlObj *pSql);
void doCleanupSubqueries(SSqlObj *pSql, int32_t numOfSubs);
void tscFreeRetrieveSupporters(SSqlObj *pSql);
#ifdef __cplusplus
}

View File

@ -2050,6 +2050,19 @@ void doCleanupSubqueries(SSqlObj *pSql, int32_t numOfSubs) {
}
}
void tscFreeRetrieveSupporters(SSqlObj *pSql) {
for(int32_t i = 0; i < pSql->subState.numOfSub; ++i) {
SSqlObj* pSub = pSql->pSubs[i];
assert(pSub != NULL);
SRetrieveSupport* pSupport = pSub->param;
tfree(pSupport->localBuffer);
tfree(pSub->param);
}
}
void tscLockByThread(int64_t *lockedBy) {
int64_t tid = taosGetSelfPthreadId();
int i = 0;
@ -2731,6 +2744,8 @@ void tscHandleSubqueryError(SRetrieveSupport *trsupport, SSqlObj *pSql, int numO
SSqlObj *userSql = ((SRetrieveSupport*)pParentSql->param)->pParentSql;
tscFreeRetrieveSupporters(pParentSql);
tscFreeSubobj(userSql);
tfree(userSql->pSubs);

View File

@ -3767,6 +3767,8 @@ static void tscSubqueryCompleteCallback(void* param, TAOS_RES* tres, int code) {
SSqlObj *userSql = ((SRetrieveSupport*)pParentSql->param)->pParentSql;
tscFreeRetrieveSupporters(pParentSql);
tscFreeSubobj(userSql);
tfree(userSql->pSubs);