fix: possible memory leak when error occurs in thash.c

This commit is contained in:
Hongze Cheng 2024-09-02 15:33:10 +08:00
parent dc9bde6838
commit feaa11374b
1 changed files with 1 additions and 0 deletions

View File

@ -285,6 +285,7 @@ SHashObj *taosHashInit(size_t capacity, _hash_fn_t fn, bool update, SHashLockTyp
}
if (taosArrayPush(pHashObj->pMemBlock, &p) == NULL) {
taosMemoryFree(p);
taosArrayDestroy(pHashObj->pMemBlock);
taosMemoryFree(pHashObj->hashList);
taosMemoryFree(pHashObj);