fix:[TD-30819] fix memory leak in SqlFunctionCtx.
This commit is contained in:
parent
0fcc57b52a
commit
154ef739d9
|
@ -909,12 +909,21 @@ void initBasicInfo(SOptrBasicInfo* pInfo, SSDataBlock* pBlock) {
|
||||||
initResultRowInfo(&pInfo->resultRowInfo);
|
initResultRowInfo(&pInfo->resultRowInfo);
|
||||||
}
|
}
|
||||||
|
|
||||||
static void* destroySqlFunctionCtx(SqlFunctionCtx* pCtx, int32_t numOfOutput) {
|
static void* destroySqlFunctionCtx(SqlFunctionCtx* pCtx, SExprInfo* pExpr, int32_t numOfOutput) {
|
||||||
if (pCtx == NULL) {
|
if (pCtx == NULL) {
|
||||||
return NULL;
|
return NULL;
|
||||||
}
|
}
|
||||||
|
|
||||||
for (int32_t i = 0; i < numOfOutput; ++i) {
|
for (int32_t i = 0; i < numOfOutput; ++i) {
|
||||||
|
if (pExpr != NULL) {
|
||||||
|
SExprInfo* pExprInfo = &pExpr[i];
|
||||||
|
for (int32_t j = 0; j < pExprInfo->base.numOfParams; ++j) {
|
||||||
|
if (pExprInfo->base.pParam[j].type == FUNC_PARAM_TYPE_VALUE) {
|
||||||
|
taosMemoryFree(pCtx[i].input.pData[j]);
|
||||||
|
taosMemoryFree(pCtx[i].input.pColumnDataAgg[j]);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
for (int32_t j = 0; j < pCtx[i].numOfParams; ++j) {
|
for (int32_t j = 0; j < pCtx[i].numOfParams; ++j) {
|
||||||
taosVariantDestroy(&pCtx[i].param[j].param);
|
taosVariantDestroy(&pCtx[i].param[j].param);
|
||||||
}
|
}
|
||||||
|
@ -947,7 +956,7 @@ int32_t initExprSupp(SExprSupp* pSup, SExprInfo* pExprInfo, int32_t numOfExpr, S
|
||||||
}
|
}
|
||||||
|
|
||||||
void cleanupExprSupp(SExprSupp* pSupp) {
|
void cleanupExprSupp(SExprSupp* pSupp) {
|
||||||
destroySqlFunctionCtx(pSupp->pCtx, pSupp->numOfExprs);
|
destroySqlFunctionCtx(pSupp->pCtx, pSupp->pExprInfo, pSupp->numOfExprs);
|
||||||
if (pSupp->pExprInfo != NULL) {
|
if (pSupp->pExprInfo != NULL) {
|
||||||
destroyExprInfo(pSupp->pExprInfo, pSupp->numOfExprs);
|
destroyExprInfo(pSupp->pExprInfo, pSupp->numOfExprs);
|
||||||
taosMemoryFreeClear(pSupp->pExprInfo);
|
taosMemoryFreeClear(pSupp->pExprInfo);
|
||||||
|
|
Loading…
Reference in New Issue