Merge pull request #27015 from taosdata/fix/TD-31268-3.0

fix: malloc failed in thash.c
This commit is contained in:
Hongze Cheng 2024-08-06 20:08:03 +08:00 committed by GitHub
commit a4ddc6c6e6
No known key found for this signature in database
GPG Key ID: B5690EEEBB952194
1 changed files with 3 additions and 0 deletions

View File

@ -624,6 +624,9 @@ void taosHashTableResize(SHashObj *pHashObj) {
size_t inc = newCapacity - pHashObj->capacity; size_t inc = newCapacity - pHashObj->capacity;
void *p = taosMemoryCalloc(inc, sizeof(SHashEntry)); void *p = taosMemoryCalloc(inc, sizeof(SHashEntry));
if (p == NULL) {
return;
}
for (int32_t i = 0; i < inc; ++i) { for (int32_t i = 0; i < inc; ++i) {
pHashObj->hashList[i + pHashObj->capacity] = (void *)((char *)p + i * sizeof(SHashEntry)); pHashObj->hashList[i + pHashObj->capacity] = (void *)((char *)p + i * sizeof(SHashEntry));