Merge pull request #27574 from taosdata/fix/3.0/TD-31818
fix:[TD-31818] fix memory leak allocated by mode function.
This commit is contained in:
commit
5c7506bfe0
|
@ -6007,6 +6007,7 @@ int32_t modeFunctionSetup(SqlFunctionCtx* pCtx, SResultRowEntryInfo* pResInfo) {
|
||||||
|
|
||||||
pInfo->buf = taosMemoryMalloc(pInfo->colBytes);
|
pInfo->buf = taosMemoryMalloc(pInfo->colBytes);
|
||||||
if (NULL == pInfo->buf) {
|
if (NULL == pInfo->buf) {
|
||||||
|
taosHashCleanup(pInfo->pHash);
|
||||||
return TSDB_CODE_OUT_OF_MEMORY;
|
return TSDB_CODE_OUT_OF_MEMORY;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -6114,6 +6115,7 @@ int32_t modeFinalize(SqlFunctionCtx* pCtx, SSDataBlock* pBlock) {
|
||||||
SColumnInfoData* pCol = taosArrayGet(pBlock->pDataBlock, slotId);
|
SColumnInfoData* pCol = taosArrayGet(pBlock->pDataBlock, slotId);
|
||||||
int32_t currentRow = pBlock->info.rows;
|
int32_t currentRow = pBlock->info.rows;
|
||||||
if (NULL == pCol) {
|
if (NULL == pCol) {
|
||||||
|
modeFunctionCleanup(pInfo);
|
||||||
return TSDB_CODE_OUT_OF_RANGE;
|
return TSDB_CODE_OUT_OF_RANGE;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -6145,6 +6147,7 @@ int32_t modeFinalize(SqlFunctionCtx* pCtx, SSDataBlock* pBlock) {
|
||||||
|
|
||||||
code = colDataSetVal(pCol, currentRow, pData, false);
|
code = colDataSetVal(pCol, currentRow, pData, false);
|
||||||
if (TSDB_CODE_SUCCESS != code) {
|
if (TSDB_CODE_SUCCESS != code) {
|
||||||
|
modeFunctionCleanup(pInfo);
|
||||||
return code;
|
return code;
|
||||||
}
|
}
|
||||||
code = setSelectivityValue(pCtx, pBlock, &resTuplePos, currentRow);
|
code = setSelectivityValue(pCtx, pBlock, &resTuplePos, currentRow);
|
||||||
|
|
Loading…
Reference in New Issue