fix: free invalid mem

This commit is contained in:
xsren 2024-09-02 15:12:47 +08:00
parent 35633bb637
commit a673f500b8
3 changed files with 6 additions and 1 deletions

View File

@ -371,6 +371,7 @@ static int32_t doSetInputDataBlock(SExprSupp* pExprSup, SSDataBlock* pBlock, int
} }
if (hasPk && (j == pkParamIdx)) { if (hasPk && (j == pkParamIdx)) {
pInput->pPrimaryKey = pInput->pData[j]; pInput->pPrimaryKey = pInput->pData[j];
QUERY_CHECK_CONDITION((pInput->pData[j]->pData != NULL), code, lino, _end, TSDB_CODE_QRY_EXECUTOR_INTERNAL_ERROR);
} }
QUERY_CHECK_CONDITION((pInput->pData[j] != NULL), code, lino, _end, TSDB_CODE_QRY_EXECUTOR_INTERNAL_ERROR); QUERY_CHECK_CONDITION((pInput->pData[j] != NULL), code, lino, _end, TSDB_CODE_QRY_EXECUTOR_INTERNAL_ERROR);
} else if (pFuncParam->type == FUNC_PARAM_TYPE_VALUE) { } else if (pFuncParam->type == FUNC_PARAM_TYPE_VALUE) {

View File

@ -1919,10 +1919,10 @@ _return:
if (pInfo != NULL) { if (pInfo != NULL) {
destroyMergeJoinOperator(pInfo); destroyMergeJoinOperator(pInfo);
} }
destroyOperatorAndDownstreams(pOperator, pDownstream, oldNum);
if (newDownstreams) { if (newDownstreams) {
taosMemoryFree(pDownstream); taosMemoryFree(pDownstream);
} }
destroyOperatorAndDownstreams(pOperator, pDownstream, oldNum);
pTaskInfo->code = code; pTaskInfo->code = code;
return code; return code;

View File

@ -3163,6 +3163,10 @@ static int32_t doSaveLastrow(SqlFunctionCtx* pCtx, char* pData, int32_t rowIndex
} }
if (pCtx->hasPrimaryKey) { if (pCtx->hasPrimaryKey) {
if (colDataIsNull_s(pkCol, rowIndex)) {
qError("primary key is null, rowIndex:%d", rowIndex);
return TSDB_CODE_FUNC_FUNTION_ERROR;
}
char* pkData = colDataGetData(pkCol, rowIndex); char* pkData = colDataGetData(pkCol, rowIndex);
if (IS_VAR_DATA_TYPE(pInfo->pkType)) { if (IS_VAR_DATA_TYPE(pInfo->pkType)) {
pInfo->pkBytes = varDataTLen(pkData); pInfo->pkBytes = varDataTLen(pkData);