Wenyong Huang
2024-01-23 21:38:30 +08:00
committed by GitHub
parent ab97d543e0
commit 9f64340529
9 changed files with 20 additions and 17 deletions

View File

@ -51,7 +51,9 @@ bh_hash_map_create(uint32 size, bool use_lock, HashFunc hash_func,
+ sizeof(HashMapElem *) * (uint64)size
+ (use_lock ? sizeof(korp_mutex) : 0);
if (total_size >= UINT32_MAX || !(map = BH_MALLOC((uint32)total_size))) {
/* size <= HASH_MAP_MAX_SIZE, so total_size won't be larger than
UINT32_MAX, no need to check integer overflow */
if (!(map = BH_MALLOC((uint32)total_size))) {
LOG_ERROR("HashMap create failed: alloc memory failed.\n");
return NULL;
}