Merge pull request #27538 from taosdata/fix/TD-31769-3.0

fix(query)[TD-31499]. Fix double free on certain field memory allocation failure
This commit is contained in:
Pan Wei 2024-08-29 16:52:22 +08:00 committed by GitHub
commit 9e56c7242e
No known key found for this signature in database
GPG Key ID: B5690EEEBB952194
1 changed files with 4 additions and 14 deletions

View File

@ -524,22 +524,12 @@ static void cleanupBlockOrderSupporter(SBlockOrderSupporter* pSup) {
}
static int32_t initBlockOrderSupporter(SBlockOrderSupporter* pSup, int32_t numOfTables) {
pSup->numOfBlocksPerTable = taosMemoryCalloc(1, sizeof(int32_t) * numOfTables);
if(pSup->numOfBlocksPerTable == NULL) {
cleanupBlockOrderSupporter(pSup);
return terrno;
}
pSup->indexPerTable = taosMemoryCalloc(1, sizeof(int32_t) * numOfTables);
if(pSup->indexPerTable == NULL) {
taosMemoryFree(pSup->numOfBlocksPerTable);
cleanupBlockOrderSupporter(pSup);
return terrno;
}
pSup->pDataBlockInfo = taosMemoryCalloc(1, POINTER_BYTES * numOfTables);
if (pSup->pDataBlockInfo == NULL) {
pSup->indexPerTable = taosMemoryCalloc(1, sizeof(int32_t) * numOfTables);
pSup->numOfBlocksPerTable = taosMemoryCalloc(1, sizeof(int32_t) * numOfTables);
pSup->numOfTables = 0;
if (pSup->pDataBlockInfo == NULL || pSup->indexPerTable == NULL || pSup->numOfBlocksPerTable == NULL) {
cleanupBlockOrderSupporter(pSup);
taosMemoryFree(pSup->numOfBlocksPerTable);
taosMemoryFree(pSup->indexPerTable);
return terrno;
}