fix NULL deref in new_fluid_hashtable_full()

This commit is contained in:
derselbst 2018-10-02 19:33:50 +02:00
parent 6f8a574e36
commit b31afd65a5

View file

@ -415,7 +415,13 @@ new_fluid_hashtable_full(fluid_hash_func_t hash_func,
hashtable->key_destroy_func = key_destroy_func;
hashtable->value_destroy_func = value_destroy_func;
hashtable->nodes = FLUID_ARRAY(fluid_hashnode_t *, hashtable->size);
FLUID_MEMSET(hashtable->nodes, 0, hashtable->size * sizeof(fluid_hashnode_t *));
if(hashtable->nodes == NULL)
{
delete_fluid_hashtable(hashtable);
FLUID_LOG(FLUID_ERR, "Out of memory");
return NULL;
}
FLUID_MEMSET(hashtable->nodes, 0, hashtable->size * sizeof(*hashtable->nodes));
return hashtable;
}