fix(query): fix memory leak in query super table.
This commit is contained in:
parent
1346926168
commit
91c1ae4168
|
@ -3503,11 +3503,7 @@ static void destroyOperatorInfo(SOperatorInfo* pOperator) {
|
||||||
pOperator->numOfDownstream = 0;
|
pOperator->numOfDownstream = 0;
|
||||||
}
|
}
|
||||||
|
|
||||||
if (pOperator->exprSupp.pExprInfo != NULL) {
|
cleanupExprSupp(&pOperator->exprSupp);
|
||||||
destroyExprInfo(pOperator->exprSupp.pExprInfo, pOperator->exprSupp.numOfExprs);
|
|
||||||
}
|
|
||||||
|
|
||||||
taosMemoryFreeClear(pOperator->exprSupp.pExprInfo);
|
|
||||||
taosMemoryFreeClear(pOperator);
|
taosMemoryFreeClear(pOperator);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -3586,6 +3582,25 @@ void initBasicInfo(SOptrBasicInfo* pInfo, SSDataBlock* pBlock) {
|
||||||
initResultRowInfo(&pInfo->resultRowInfo);
|
initResultRowInfo(&pInfo->resultRowInfo);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
static void* destroySqlFunctionCtx(SqlFunctionCtx* pCtx, int32_t numOfOutput) {
|
||||||
|
if (pCtx == NULL) {
|
||||||
|
return NULL;
|
||||||
|
}
|
||||||
|
|
||||||
|
for (int32_t i = 0; i < numOfOutput; ++i) {
|
||||||
|
for (int32_t j = 0; j < pCtx[i].numOfParams; ++j) {
|
||||||
|
taosVariantDestroy(&pCtx[i].param[j].param);
|
||||||
|
}
|
||||||
|
|
||||||
|
taosMemoryFreeClear(pCtx[i].subsidiaries.pCtx);
|
||||||
|
taosMemoryFree(pCtx[i].input.pData);
|
||||||
|
taosMemoryFree(pCtx[i].input.pColumnDataAgg);
|
||||||
|
}
|
||||||
|
|
||||||
|
taosMemoryFreeClear(pCtx);
|
||||||
|
return NULL;
|
||||||
|
}
|
||||||
|
|
||||||
int32_t initExprSupp(SExprSupp* pSup, SExprInfo* pExprInfo, int32_t numOfExpr) {
|
int32_t initExprSupp(SExprSupp* pSup, SExprInfo* pExprInfo, int32_t numOfExpr) {
|
||||||
pSup->pExprInfo = pExprInfo;
|
pSup->pExprInfo = pExprInfo;
|
||||||
pSup->numOfExprs = numOfExpr;
|
pSup->numOfExprs = numOfExpr;
|
||||||
|
@ -3599,6 +3614,16 @@ int32_t initExprSupp(SExprSupp* pSup, SExprInfo* pExprInfo, int32_t numOfExpr) {
|
||||||
return TSDB_CODE_SUCCESS;
|
return TSDB_CODE_SUCCESS;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
void cleanupExprSupp(SExprSupp* pSupp) {
|
||||||
|
destroySqlFunctionCtx(pSupp->pCtx, pSupp->numOfExprs);
|
||||||
|
if (pSupp->pExprInfo != NULL) {
|
||||||
|
destroyExprInfo(pSupp->pExprInfo, pSupp->numOfExprs);
|
||||||
|
}
|
||||||
|
|
||||||
|
taosMemoryFreeClear(pSupp->pExprInfo);
|
||||||
|
taosMemoryFree(pSupp->rowEntryInfoOffset);
|
||||||
|
}
|
||||||
|
|
||||||
SOperatorInfo* createAggregateOperatorInfo(SOperatorInfo* downstream, SExprInfo* pExprInfo, int32_t numOfCols,
|
SOperatorInfo* createAggregateOperatorInfo(SOperatorInfo* downstream, SExprInfo* pExprInfo, int32_t numOfCols,
|
||||||
SSDataBlock* pResultBlock, SNode* pCondition, SExprInfo* pScalarExprInfo,
|
SSDataBlock* pResultBlock, SNode* pCondition, SExprInfo* pScalarExprInfo,
|
||||||
int32_t numOfScalarExpr, SExecTaskInfo* pTaskInfo) {
|
int32_t numOfScalarExpr, SExecTaskInfo* pTaskInfo) {
|
||||||
|
@ -3649,25 +3674,6 @@ _error:
|
||||||
return NULL;
|
return NULL;
|
||||||
}
|
}
|
||||||
|
|
||||||
static void* destroySqlFunctionCtx(SqlFunctionCtx* pCtx, int32_t numOfOutput) {
|
|
||||||
if (pCtx == NULL) {
|
|
||||||
return NULL;
|
|
||||||
}
|
|
||||||
|
|
||||||
for (int32_t i = 0; i < numOfOutput; ++i) {
|
|
||||||
for (int32_t j = 0; j < pCtx[i].numOfParams; ++j) {
|
|
||||||
taosVariantDestroy(&pCtx[i].param[j].param);
|
|
||||||
}
|
|
||||||
|
|
||||||
taosMemoryFreeClear(pCtx[i].subsidiaries.pCtx);
|
|
||||||
taosMemoryFree(pCtx[i].input.pData);
|
|
||||||
taosMemoryFree(pCtx[i].input.pColumnDataAgg);
|
|
||||||
}
|
|
||||||
|
|
||||||
taosMemoryFreeClear(pCtx);
|
|
||||||
return NULL;
|
|
||||||
}
|
|
||||||
|
|
||||||
void cleanupBasicInfo(SOptrBasicInfo* pInfo) {
|
void cleanupBasicInfo(SOptrBasicInfo* pInfo) {
|
||||||
assert(pInfo != NULL);
|
assert(pInfo != NULL);
|
||||||
cleanupResultRowInfo(&pInfo->resultRowInfo);
|
cleanupResultRowInfo(&pInfo->resultRowInfo);
|
||||||
|
@ -3709,13 +3715,6 @@ static void destroyProjectOperatorInfo(void* param, int32_t numOfOutput) {
|
||||||
taosMemoryFreeClear(param);
|
taosMemoryFreeClear(param);
|
||||||
}
|
}
|
||||||
|
|
||||||
void cleanupExprSupp(SExprSupp* pSupp) {
|
|
||||||
destroySqlFunctionCtx(pSupp->pCtx, pSupp->numOfExprs);
|
|
||||||
destroyExprInfo(pSupp->pExprInfo, pSupp->numOfExprs);
|
|
||||||
|
|
||||||
taosMemoryFree(pSupp->rowEntryInfoOffset);
|
|
||||||
}
|
|
||||||
|
|
||||||
static void destroyIndefinitOperatorInfo(void* param, int32_t numOfOutput) {
|
static void destroyIndefinitOperatorInfo(void* param, int32_t numOfOutput) {
|
||||||
SIndefOperatorInfo* pInfo = (SIndefOperatorInfo*)param;
|
SIndefOperatorInfo* pInfo = (SIndefOperatorInfo*)param;
|
||||||
cleanupBasicInfo(&pInfo->binfo);
|
cleanupBasicInfo(&pInfo->binfo);
|
||||||
|
|
|
@ -578,6 +578,7 @@ static void destroyTableScanOperatorInfo(void* param, int32_t numOfOutput) {
|
||||||
taosArrayDestroy(pTableScanInfo->pColMatchInfo);
|
taosArrayDestroy(pTableScanInfo->pColMatchInfo);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
cleanupExprSupp(&pTableScanInfo->pseudoSup);
|
||||||
taosMemoryFreeClear(param);
|
taosMemoryFreeClear(param);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
Loading…
Reference in New Issue