fix: fix case when crash issue

This commit is contained in:
dapan1121 2022-10-18 11:54:30 +08:00
parent 951857430e
commit ab7a00abbe
3 changed files with 18 additions and 1 deletions

View File

@ -1724,6 +1724,9 @@ static void destroyStateWindowOperatorInfo(void* param) {
cleanupBasicInfo(&pInfo->binfo); cleanupBasicInfo(&pInfo->binfo);
taosMemoryFreeClear(pInfo->stateKey.pData); taosMemoryFreeClear(pInfo->stateKey.pData);
cleanupExprSupp(&pInfo->scalarSup); cleanupExprSupp(&pInfo->scalarSup);
colDataDestroy(&pInfo->twAggSup.timeWindowData);
cleanupAggSup(&pInfo->aggSup);
cleanupGroupResInfo(&pInfo->groupResInfo);
taosMemoryFreeClear(param); taosMemoryFreeClear(param);
} }

View File

@ -629,6 +629,8 @@ _return:
sclFreeParam(pWhen); sclFreeParam(pWhen);
sclFreeParam(pThen); sclFreeParam(pThen);
taosMemoryFree(pWhen);
taosMemoryFree(pThen);
SCL_RET(code); SCL_RET(code);
} }
@ -664,6 +666,8 @@ int32_t sclWalkWhenList(SScalarCtx *ctx, SNodeList* pList, struct SListCell* pCe
sclFreeParam(pWhen); sclFreeParam(pWhen);
sclFreeParam(pThen); sclFreeParam(pThen);
taosMemoryFreeClear(pWhen);
taosMemoryFreeClear(pThen);
} }
if (pElse) { if (pElse) {
@ -688,6 +692,8 @@ _return:
sclFreeParam(pWhen); sclFreeParam(pWhen);
sclFreeParam(pThen); sclFreeParam(pThen);
taosMemoryFree(pWhen);
taosMemoryFree(pThen);
SCL_RET(code); SCL_RET(code);
} }
@ -929,6 +935,10 @@ int32_t sclExecCaseWhen(SCaseWhenNode *node, SScalarCtx *ctx, SScalarParam *outp
sclFreeParam(&comp); sclFreeParam(&comp);
sclFreeParam(pWhen); sclFreeParam(pWhen);
sclFreeParam(pThen); sclFreeParam(pThen);
taosMemoryFree(pCase);
taosMemoryFree(pElse);
taosMemoryFree(pWhen);
taosMemoryFree(pThen);
return TSDB_CODE_SUCCESS; return TSDB_CODE_SUCCESS;
@ -940,6 +950,10 @@ _return:
sclFreeParam(pWhen); sclFreeParam(pWhen);
sclFreeParam(pThen); sclFreeParam(pThen);
sclFreeParam(output); sclFreeParam(output);
taosMemoryFree(pCase);
taosMemoryFree(pElse);
taosMemoryFree(pWhen);
taosMemoryFree(pThen);
SCL_RET(code); SCL_RET(code);
} }

View File

@ -654,7 +654,7 @@ int32_t vectorConvertSingleColImpl(const SScalarParam* pIn, SScalarParam* pOut,
return TSDB_CODE_APP_ERROR; return TSDB_CODE_APP_ERROR;
} }
int32_t rstart = startIndex >= 0 ? startIndex : 0; int32_t rstart = (startIndex >= 0 && startIndex < pIn->numOfRows) ? startIndex : 0;
int32_t rend = numOfRows > 0 ? rstart + numOfRows - 1 : rstart + pIn->numOfRows - 1; int32_t rend = numOfRows > 0 ? rstart + numOfRows - 1 : rstart + pIn->numOfRows - 1;
SSclVectorConvCtx cCtx = {pIn, pOut, rstart, rend, pInputCol->info.type, pOutputCol->info.type}; SSclVectorConvCtx cCtx = {pIn, pOut, rstart, rend, pInputCol->info.type, pOutputCol->info.type};