提交 176af30a 编写于 作者: W wpan

fix mem leak

上级 f85b81e0
......@@ -52,6 +52,8 @@ int tsInsertInitialCheck(SSqlObj *pSql);
void doCleanupSubqueries(SSqlObj *pSql, int32_t numOfSubs);
void tscFreeRetrieveSupporters(SSqlObj *pSql);
#ifdef __cplusplus
}
......
......@@ -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);
......
......@@ -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);
......
Markdown is supported
0% .
You are about to add 0 people to the discussion. Proceed with caution.
先完成此消息的编辑!
想要评论请 注册