Hashmap: Check for failure of first malloc.

This commit is contained in:
Michael Drake 2020-02-24 08:23:45 +00:00
parent 3cceb8ff2b
commit a59646cbf8
1 changed files with 3 additions and 0 deletions

View File

@ -67,6 +67,9 @@ hashmap_t *
hashmap_create(hashmap_parameters_t *params)
{
hashmap_t *ret = malloc(sizeof(hashmap_t));
if (ret == NULL) {
return NULL;
}
ret->params = params;
ret->bucket_count = DEFAULT_HASHMAP_BUCKETS;